Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.CodeDom.Compiler;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.AI;
- public class MapEvolve : MonoBehaviour
- {
- public NavMeshSurface champSurface;
- public NavMeshSurface minionSurface;
- public GameObject tempTerrain;
- void Start()
- {
- NavMesh.RemoveAllNavMeshData();
- champSurface.BuildNavMesh();
- minionSurface.BuildNavMesh();
- }
- void Update()
- {
- if (Input.GetKeyDown(KeyCode.Delete)) {
- ChangeTempTerrainStateAndBake();
- }
- }
- void ChangeTempTerrainStateAndBake() // simple toggle for temporary terrain, placeholder for more complex stuff in the future, if i ever make this work
- {
- if (tempTerrain.activeInHierarchy == true)
- {
- tempTerrain.SetActive(false);
- NavMesh.RemoveAllNavMeshData();
- champSurface.BuildNavMesh();
- minionSurface.BuildNavMesh();
- }
- else if (tempTerrain.activeInHierarchy == false)
- {
- tempTerrain.SetActive(true);
- NavMesh.RemoveAllNavMeshData();
- champSurface.BuildNavMesh();
- minionSurface.BuildNavMesh();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement