Guest User

Untitled

a guest
Jun 12th, 2020
27
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.CodeDom.Compiler;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.AI;
  6.  
  7. public class MapEvolve : MonoBehaviour
  8. {
  9.  
  10. public NavMeshSurface champSurface;
  11. public NavMeshSurface minionSurface;
  12.  
  13. public GameObject tempTerrain;
  14.  
  15.  
  16. void Start()
  17. {
  18. NavMesh.RemoveAllNavMeshData();
  19. champSurface.BuildNavMesh();
  20. minionSurface.BuildNavMesh();
  21. }
  22.  
  23. void Update()
  24. {
  25. if (Input.GetKeyDown(KeyCode.Delete)) {
  26. ChangeTempTerrainStateAndBake();
  27. }
  28.  
  29. }
  30. void ChangeTempTerrainStateAndBake() // simple toggle for temporary terrain, placeholder for more complex stuff in the future, if i ever make this work
  31. {
  32. if (tempTerrain.activeInHierarchy == true)
  33. {
  34. tempTerrain.SetActive(false);
  35. NavMesh.RemoveAllNavMeshData();
  36. champSurface.BuildNavMesh();
  37. minionSurface.BuildNavMesh();
  38. }
  39.  
  40. else if (tempTerrain.activeInHierarchy == false)
  41. {
  42. tempTerrain.SetActive(true);
  43. NavMesh.RemoveAllNavMeshData();
  44. champSurface.BuildNavMesh();
  45. minionSurface.BuildNavMesh();
  46. }
  47. }
  48.  
  49. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×