Example #1
0
        public void InterestPos(AreaStep prevStep)
        {
            Collider[] col = Physics.OverlapSphere(prevStep.position, prevStep.Radius / 2, LayerMask.GetMask("interest"));

            if (col != null && col.Length > 0)
            {
                int      indexRandom = Random.Range(0, col.Length - 1);
                Collider c           = col[indexRandom];
                this.position = c.bounds.center;
            }
        }
Example #2
0
 void NextStep()
 {
     if (step < Steps.Length)
     {
         AreaStep prevArea = actualArea;
         actualArea = Steps[step++];
         actualArea.SelectPos(prevArea);
         if (actualArea.Drop)
         {
             Airplane.AIRPLANE().ResetForDrop(actualArea.position);
         }
     }
 }
Example #3
0
        public void RandomPos(AreaStep prevStep)
        {
            Vector3 pos = new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f));

            pos.Normalize();

            float nRadius = this.Radius / 2;

            pos *= nRadius;

            Vector3 finalPos = prevStep.position + pos;

            this.position = finalPos;
        }
Example #4
0
        public void SelectPos(AreaStep prevStep)
        {
            switch (mode)
            {
            case AreaStepMode.random:
                RandomPos(prevStep);
                break;

            case AreaStepMode.interest:
                InterestPos(prevStep);
                break;

            default:
                break;
            }
        }