private GameObject CreateGhost(TerrainObject selectedPrefab, Vector3 pos) { UnityGraph.LogGameObject(selectedPrefab.gameObject); ResourceDispenser dispenser = selectedPrefab.GetComponent <ResourceDispenser>(); GameObject obj = GameObject.Instantiate(dispenser.AnimatedTransform.GetChild(0).gameObject); obj.layer = Globals.inst.layerTrigger; foreach (var collider in obj.GetComponentsInChildren <MeshCollider>()) { collider.enabled = false; } return(obj); }
private void DeleteRock(bool hit, RaycastHit ray) { if (hit && ray.transform.gameObject.IsScenery()) { var vis = ray.transform.gameObject.GetComponentInParents <Visible>(true); UnityGraph.LogGameObject(vis.transform.gameObject); var terrain = vis.gameObject.GetComponent <TerrainObject>(); var dispenser = vis.gameObject.GetComponent <ResourceDispenser>(); var info = dispenser.Store(); dispenser.SetAwake(false); info.health = 0f; info.regrowDelay = -1f; dispenser.Restore(info); dispenser.SetAwake(true); } }
public UnityPathPlanner(UnityGraph UnityGraph, Search_AStar <UnityNode, UnityEdge> CurrentSearch) { this.Graph = UnityGraph.Graph; this.UnityGraph = UnityGraph; this.Search = CurrentSearch; }