コード例 #1
0
 protected override void Start()
 {
     base.Start();
     possibleToFlyTo = new List <Vector3>();
     if (FLIGHT_HEIGHT == 0)
     {
         Debug.LogError("FLIGHT_HEIGHT not set!");
     }
     flyScript = GetComponentInChildren <FlyScript>();
 }
コード例 #2
0
    void OnTriggerEnter2D(Collider2D otherCollider)
    {
        // Is this a shot?
        ShotScript shot = otherCollider.gameObject.GetComponent <ShotScript>();
        FlyScript  fly  = otherCollider.gameObject.GetComponent <FlyScript> ();

        if (shot != null)
        {
            // Avoid friendly fire
            if (shot.isEnemyShot != isEnemy)
            {
                Damage(shot.damage);
                // Destroy the shot
                Destroy(shot.gameObject);                 // Remember to always target the game object, otherwise you will just remove the script
            }
        }
        if (fly != null)
        {
            Destroy(fly.gameObject);
            poops.poops++;
        }
    }
コード例 #3
0
 private void Awake()
 {
     if (!mController)
     {
         mController = GetComponent <MovementController>();
     }
     if (!sController)
     {
         sController = GetComponent <SlideScript>();
     }
     if (!cController)
     {
         cController = GetComponent <CrouchScript>();
     }
     if (!gController)
     {
         gController = GetComponent <GlideScript>();
     }
     if (!fController)
     {
         fController = GetComponent <FlyScript>();
     }
 }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     fly = gameObject.GetComponent <FlyScript>();
 }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     fly = gameObject.GetComponent<FlyScript>();
 }