public void OnDrawGizmos()
    {
        if (_thisT == null)
        {
            _thisT = transform;
        }
        if (_controller == null)
        {
            _controller = _thisT.parent.GetComponent <LandingSpotController>();
        }

        Gizmos.color = Color.yellow;
        // Draw a yellow cube at the transforms position
        if ((landingChild != null) && landing)
        {
            Gizmos.DrawLine(_thisT.position, landingChild._thisT.position);
        }
        if (_thisT.rotation.eulerAngles.x != 0 || _thisT.rotation.eulerAngles.z != 0)
        {
            _thisT.eulerAngles = new Vector3(0.0f, _thisT.eulerAngles.y, 0.0f);
        }
        Gizmos.DrawCube(new Vector3(_thisT.position.x, _thisT.position.y, _thisT.position.z), Vector3.one * _controller._gizmoSize);
        Gizmos.DrawCube(_thisT.position + (_thisT.forward * _controller._gizmoSize), Vector3.one * _controller._gizmoSize * .5f);
        Gizmos.color = new Color(1.0f, 1.0f, 0.0f, .05f);
        Gizmos.DrawWireSphere(_thisT.position, _controller._maxBirdDistance);
    }
Exemple #2
0
    public void OnDrawGizmos()
    {
        if (Object.op_Equality((Object)this._thisT, (Object)null))
        {
            this._thisT = ((Component)this).get_transform();
        }
        if (Object.op_Equality((Object)this._controller, (Object)null))
        {
            this._controller = (LandingSpotController)((Component)this._thisT.get_parent()).GetComponent <LandingSpotController>();
        }
        Gizmos.set_color(Color.get_yellow());
        if (Object.op_Inequality((Object)this.landingChild, (Object)null) && this.landing)
        {
            Gizmos.DrawLine(this._thisT.get_position(), this.landingChild._thisT.get_position());
        }
        Quaternion rotation1 = this._thisT.get_rotation();

        if (((Quaternion) ref rotation1).get_eulerAngles().x == 0.0)
        {
            Quaternion rotation2 = this._thisT.get_rotation();
            if (((Quaternion) ref rotation2).get_eulerAngles().z == 0.0)
            {
                goto label_9;
            }
        }
        this._thisT.set_eulerAngles(new Vector3(0.0f, (float)this._thisT.get_eulerAngles().y, 0.0f));
label_9:
        Gizmos.DrawCube(new Vector3((float)this._thisT.get_position().x, (float)this._thisT.get_position().y, (float)this._thisT.get_position().z), Vector3.op_Multiply(Vector3.get_one(), this._controller._gizmoSize));
        Gizmos.DrawCube(Vector3.op_Addition(this._thisT.get_position(), Vector3.op_Multiply(this._thisT.get_forward(), this._controller._gizmoSize)), Vector3.op_Multiply(Vector3.op_Multiply(Vector3.get_one(), this._controller._gizmoSize), 0.5f));
        Gizmos.set_color(new Color(1f, 1f, 0.0f, 0.05f));
        Gizmos.DrawWireSphere(this._thisT.get_position(), this._controller._maxBirdDistance);
    }
Exemple #3
0
    private bool CheckDistanceToLandingSpot(LandingSpotController lc)
    {
        Transform child = ((Component)lc).get_transform().GetChild(this.ls);

        if (Object.op_Inequality((Object)((LandingSpot)((Component)child).GetComponent <LandingSpot>()).landingChild, (Object)null))
        {
            Vector3 vector3 = Vector3.op_Subtraction(child.get_position(), ((Component)this).get_transform().get_position());
            if ((double)((Vector3) ref vector3).get_sqrMagnitude() < (double)this.distanceToScare * (double)this.distanceToScare)
            {
                return(true);
            }
        }
        return(false);
    }
 public void Start()
 {
     if (_thisT == null)
     {
         _thisT = transform;
     }
     if (_controller == null)
     {
         _controller = _thisT.parent.GetComponent <LandingSpotController>();
     }
     if (_controller._autoCatchDelay.x > 0)
     {
         StartCoroutine(GetFlockChild(_controller._autoCatchDelay.x, _controller._autoCatchDelay.y));
     }
 }
Exemple #5
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);
    }
Exemple #6
0
 public void Start()
 {
     if (Object.op_Equality((Object)this._thisT, (Object)null))
     {
         this._thisT = ((Component)this).get_transform();
     }
     if (Object.op_Equality((Object)this._controller, (Object)null))
     {
         this._controller = (LandingSpotController)((Component)this._thisT.get_parent()).GetComponent <LandingSpotController>();
     }
     if (this._controller._autoCatchDelay.x <= 0.0)
     {
         return;
     }
     this.StartCoroutine(this.GetFlockChild((float)this._controller._autoCatchDelay.x, (float)this._controller._autoCatchDelay.y));
 }
Exemple #7
0
    //Counts trough all the landingspots inside all the controllers (For performance this is not done in a loop)
    void IterateLandingSpots()
    {
        ls += checkEveryNthLandingSpot;
        currentController = landingSpotControllers[lsc];
        int cc = currentController.transform.childCount;

        if (ls > cc - 1)
        {
            ls = ls - cc;
            if (lsc < landingSpotControllers.Length - 1)
            {
                lsc++;
            }
            else
            {
                lsc = 0;
            }
        }
    }
Exemple #8
0
    private void IterateLandingSpots()
    {
        this.ls += this.checkEveryNthLandingSpot;
        this.currentController = this.landingSpotControllers[this.lsc];
        int childCount = ((Component)this.currentController).get_transform().get_childCount();

        if (this.ls <= childCount - 1)
        {
            return;
        }
        this.ls -= childCount;
        if (this.lsc < this.landingSpotControllers.Length - 1)
        {
            ++this.lsc;
        }
        else
        {
            this.lsc = 0;
        }
    }