示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }
示例#3
0
 public UnityPathPlanner(UnityGraph UnityGraph, Search_AStar <UnityNode, UnityEdge> CurrentSearch)
 {
     this.Graph      = UnityGraph.Graph;
     this.UnityGraph = UnityGraph;
     this.Search     = CurrentSearch;
 }