示例#1
0
        public void startDroneFlight(UnitTower electricitySource)
        {
            if (droneCorutineHndl != null)
            {
                StopCoroutine(droneCorutineHndl);
                if (moveObjectHndl != null)
                {
                    StopCoroutine(moveObjectHndl);
                }
                Destroy(drone);
            }

            drone = Instantiate(Resources.Load("UAV_Trident")) as GameObject;
            drone.transform.position = new Vector3(transform.position.x, transform.position.y + GetComponent <Collider>().bounds.size.y, transform.position.z);
            droneCorutineHndl        = StartDroneFlight(electricitySource, drone, new Vector3(transform.position.x, transform.position.y + GetComponent <Collider>().transform.position.y, transform.position.z),
                                                        new Vector3(electricitySource.transform.position.x, electricitySource.transform.position.y + electricitySource.GetComponent <Collider>().transform.position.y, electricitySource.transform.position.z));
            StartCoroutine(droneCorutineHndl);
        }
示例#2
0
        public void startDroneFlight(UnitTower electricitySource)
        {
            if (droneCorutineHndl != null)
              {
            StopCoroutine(droneCorutineHndl);
            if (moveObjectHndl != null) StopCoroutine(moveObjectHndl);
            Destroy(drone);
              }

              drone = Instantiate(Resources.Load("UAV_Trident")) as GameObject;
              drone.transform.position = new Vector3(transform.position.x, transform.position.y + GetComponent<Collider>().bounds.size.y, transform.position.z);
              droneCorutineHndl = StartDroneFlight(electricitySource, drone, new Vector3(transform.position.x, transform.position.y + GetComponent<Collider>().transform.position.y, transform.position.z),
              new Vector3(electricitySource.transform.position.x, electricitySource.transform.position.y + electricitySource.GetComponent<Collider>().transform.position.y, electricitySource.transform.position.z));
              StartCoroutine(droneCorutineHndl);
        }