Ejemplo n.º 1
0
 public void LandAll()
 {
     for (int i = 0; i < _thisT.childCount; i++)
     {
         if (_thisT.GetChild(i).GetComponent <LandingSpot>() != null)
         {
             LandingSpot spot = _thisT.GetChild(i).GetComponent <LandingSpot>();
             StartCoroutine(spot.GetFlockChild(0.0f, 2.0f));
         }
     }
 }
 public void LandAll()
 {
     for (int i = 0; i < this._thisT.childCount; i++)
     {
         if (this._thisT.GetChild(i).GetComponent <LandingSpot>() != null)
         {
             LandingSpot component = this._thisT.GetChild(i).GetComponent <LandingSpot>();
             base.StartCoroutine(component.GetFlockChild(0f, 2f));
         }
     }
 }
Ejemplo n.º 3
0
 public void ScareAll(float minDelay, float maxDelay)
 {
     for (int i = 0; i < _thisT.childCount; i++)
     {
         if (_thisT.GetChild(i).GetComponent <LandingSpot>() != null)
         {
             LandingSpot spot = _thisT.GetChild(i).GetComponent <LandingSpot>();
             spot.Invoke("ReleaseFlockChild", Random.Range(minDelay, maxDelay));
         }
     }
 }
 public void ScareAll(float minDelay, float maxDelay)
 {
     for (int i = 0; i < _thisT.childCount; i++)
     {
         if (_thisT.GetChild(i).GetComponent <LandingSpot>() != null)
         {
             LandingSpot spot = _thisT.GetChild(i).GetComponent <LandingSpot>();
             StartCoroutine(spot.ReleaseFlockChild(minDelay, maxDelay));
         }
     }
 }
Ejemplo n.º 5
0
 public void ScareAll(float minDelay, float maxDelay)
 {
     for (int i = 0; i < this._thisT.childCount; i++)
     {
         if (this._thisT.GetChild(i).GetComponent <LandingSpot>() != null)
         {
             LandingSpot component = this._thisT.GetChild(i).GetComponent <LandingSpot>();
             component.Invoke("ReleaseFlockChild", UnityEngine.Random.Range(minDelay, maxDelay));
         }
     }
 }
Ejemplo n.º 6
0
 private void CheckPlayer()
 {
     for (int i = 0; i < this._thisT.childCount; i++)
     {
         LandingSpot component = this._thisT.GetChild(i).GetComponent <LandingSpot>();
         if (component != null && component.transform.position.Distance(Player.Get().transform.position) < UnityEngine.Random.Range(this.m_ScareDistMin, this.m_ScareDistMax))
         {
             component.ReleaseFlockChild();
         }
     }
 }
Ejemplo n.º 7
0
    //This function was added to fix a error with having a button calling InstantLand
    public IEnumerator InstantLandOnStart(float delay)
    {
        yield return(new WaitForSeconds(delay));

        for (int i = 0; i < _thisT.childCount; i++)
        {
            if (_thisT.GetChild(i).GetComponent <LandingSpot>() != null)
            {
                LandingSpot spot = _thisT.GetChild(i).GetComponent <LandingSpot>();
                spot.InstantLand();
            }
        }
    }
Ejemplo n.º 8
0
    public IEnumerator InstantLand(float delay)
    {
        yield return(new WaitForSeconds(delay));

        for (int i = 0; i < this._thisT.childCount; i++)
        {
            if (this._thisT.GetChild(i).GetComponent <LandingSpot>() != null)
            {
                LandingSpot component = this._thisT.GetChild(i).GetComponent <LandingSpot>();
                component.InstantLand();
            }
        }
        yield break;
    }
Ejemplo n.º 9
0
    //Checks distance to landingspots in the current landingspot controller
    bool CheckDistanceToLandingSpot(LandingSpotController lc)
    {
        Transform   lcT    = lc.transform;
        Transform   lsT    = lcT.GetChild(ls);
        LandingSpot lcSpot = lsT.GetComponent <LandingSpot>();

        if (lcSpot.landingChild != null)
        {
            float d = (lsT.position - transform.position).sqrMagnitude;              //Vector3.Distance(lcT.GetChild(ls).position, transform.position)
            if (d < distanceToScare * distanceToScare)
            {
                return(true);
            }
        }
        return(false);
    }
 public void Start()
 {
     if (this._thisT == null)
     {
         this._thisT = base.transform;
     }
     if (this._flock == null)
     {
         this._flock = (FlockController)UnityEngine.Object.FindObjectOfType(typeof(FlockController));
         Debug.Log(this + " has no assigned FlockController, a random FlockController has been assigned");
     }
     if (this._landOnStart)
     {
         base.StartCoroutine(this.InstantLandOnStart(0.1f));
     }
     this.m_AudioSource = base.GetComponent <AudioSource>();
     this.m_LandingSpots.Clear();
     for (int i = 0; i < this._thisT.childCount; i++)
     {
         LandingSpot component = this._thisT.GetChild(i).GetComponent <LandingSpot>();
         this.m_LandingSpots.Add(component);
     }
 }
 private void CheckPlayer()
 {
     if (this.m_ReleaseAllFlockChildren)
     {
         if (!this.m_ReleaseAllChildrenUpdate && base.transform.position.Distance(Player.Get().transform.position) < UnityEngine.Random.Range(this.m_ScareDistMin, this.m_ScareDistMax))
         {
             this.m_ReleaseAllChildrenSpotList.Clear();
             for (int i = 0; i < this._thisT.childCount; i++)
             {
                 LandingSpot component = this._thisT.GetChild(i).GetComponent <LandingSpot>();
                 if (component != null)
                 {
                     this.m_ReleaseAllChildrenSpotList.Add(component);
                 }
             }
             this.m_ReleaseAllChildrenUpdate = true;
             if (this.m_AudioSource && (!this.m_PlayAudioOnce || !this.m_AudioAlreadyPlayed))
             {
                 this.m_AudioSource.Play();
                 this.m_AudioAlreadyPlayed = true;
                 return;
             }
         }
     }
     else
     {
         for (int j = 0; j < this.m_LandingSpots.Count; j++)
         {
             LandingSpot landingSpot = this.m_LandingSpots[j];
             if (landingSpot != null && landingSpot.transform.position.Distance(Player.Get().transform.position) < UnityEngine.Random.Range(this.m_ScareDistMin, this.m_ScareDistMax))
             {
                 landingSpot.ReleaseFlockChild();
             }
         }
     }
 }