예제 #1
0
 void Start()
 {
     children        = new List <GameObject> ();
     am              = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioManager> ();
     myAnim          = GetComponent <Animator> ();
     hitPoints       = maxHitPoints;
     currentMode     = MotherDroneMode.PATROLLING;
     initialPosition = transform.position;
     target          = new Vector3(initialPosition.x + distance, initialPosition.y, initialPosition.z);
 }
예제 #2
0
 void Release()
 {
     myAnim.SetBool("releasing", releasing);
     if (!releasing)
     {
         RotateUpsideDown();
         if (transform.eulerAngles.z > 170f)
         {
             releasing = true;
         }
     }
     if (releasing)
     {
         if (children.Count < 3)
         {
             Debug.Log("INSTANTIATING CHILDREN");
             children.Add(Instantiate(drone, new Vector3(transform.position.x, transform.position.y - 3, transform.position.z), Quaternion.identity));
             releasing   = false;
             currentMode = MotherDroneMode.PATROLLING;
         }
     }
 }
예제 #3
0
    void Swoop()
    {
        RotateUpsideUp();
        if (transform.position == target && target != initialPosition)
        {
            target = initialPosition;
        }
        else if (transform.position == target && target == initialPosition)
        {
            target = new Vector3(initialPosition.x + distance, initialPosition.y - swoopDistance, initialPosition.z);
            cycleCount++;
        }
        if (cycleCount % 8 > 0 && cycleCount > 1)
        {
            currentMode = MotherDroneMode.PATROLLING;
            cycleCount++;
        }
//		if (cycleCount % 10 == 0  && cycleCount > 1) {
//			releasing = true;
//			currentMode = MotherDroneMode.RELEASING;
//			cycleCount++;
//		}
        MoveTowards();
    }
예제 #4
0
 void Patrol()
 {
     RotateUpsideUp();
     if (transform.position == target && target != initialPosition)
     {
         target = initialPosition;
     }
     else if (transform.position == target && target == initialPosition)
     {
         target = new Vector3(initialPosition.x + distance, initialPosition.y, initialPosition.z);
         cycleCount++;
     }
     if (cycleCount % 5 == 0 && cycleCount > 1)
     {
         currentMode = MotherDroneMode.RELEASING;
         cycleCount++;
     }
     if (cycleCount % 3 == 0 && cycleCount > 1)
     {
         currentMode = MotherDroneMode.SWOOPING;
         cycleCount++;
     }
     MoveTowards();
 }