Ejemplo n.º 1
0
    void SummonAttackSeekers(List <RaycastHit> forwardRayHits, List <RaycastHit> backwardRayHits, List <RaycastHit> leftRayHits, List <RaycastHit> rightRayHits)
    {
        if (_stopSummoningAtkSeekers == false)
        {
            // forward
            for (int i = 0; i < forwardRayHits.Count; i++)
            {
                RaycastHit currentHit = forwardRayHits[i];

                Vector3 currentLocation = forwardRayHits[i].point;

                float currentHitX = RoundPositionFloat(currentLocation.x, _spaceSize);

                float currentHitZ = RoundPositionFloat(currentLocation.z, _spaceSize);

                Vector3 updatedLocation = new Vector3(currentHitX, currentLocation.y + 3.0f, currentHitZ);

                AttackSeeker atkSeeker = Instantiate(_attackSeekerPrefab, updatedLocation, Quaternion.identity).GetComponent <AttackSeeker>();

                atkSeeker.setAtkSeekerID(_gameData.getAttackSeekers().Count);

                _gameData.addAtkSeeker(atkSeeker);
            }

            if (backwardRayHits != null)
            {
                // backward
                for (int i = 0; i < backwardRayHits.Count; i++)
                {
                    RaycastHit currentHit = backwardRayHits[i];

                    Vector3 currentLocation = backwardRayHits[i].point;

                    float currentHitX = RoundPositionFloat(currentLocation.x, _spaceSize);

                    float currentHitZ = RoundPositionFloat(currentLocation.z, _spaceSize);

                    Vector3 updatedLocation = new Vector3(currentHitX, currentLocation.y + 3.0f, currentHitZ);

                    AttackSeeker atkSeeker = Instantiate(_attackSeekerPrefab, updatedLocation, Quaternion.identity).GetComponent <AttackSeeker>();

                    atkSeeker.setAtkSeekerID(_gameData.getAttackSeekers().Count);

                    _gameData.addAtkSeeker(atkSeeker);
                }
            }

            if (leftRayHits != null)
            {
                // left
                for (int i = 0; i < leftRayHits.Count; i++)
                {
                    RaycastHit currentHit = leftRayHits[i];

                    Vector3 currentLocation = leftRayHits[i].point;

                    float currentHitX = RoundPositionFloat(currentLocation.x, _spaceSize);

                    float currentHitZ = RoundPositionFloat(currentLocation.z, _spaceSize);

                    Vector3 updatedLocation = new Vector3(currentHitX, currentLocation.y + 3.0f, currentHitZ);

                    AttackSeeker atkSeeker = Instantiate(_attackSeekerPrefab, updatedLocation, Quaternion.identity).GetComponent <AttackSeeker>();

                    atkSeeker.setAtkSeekerID(_gameData.getAttackSeekers().Count);

                    _gameData.addAtkSeeker(atkSeeker);
                }
            }

            if (rightRayHits != null)
            {
                // right
                for (int i = 0; i < rightRayHits.Count; i++)
                {
                    RaycastHit currentHit = rightRayHits[i];

                    Vector3 currentLocation = rightRayHits[i].point;

                    float currentHitX = RoundPositionFloat(currentLocation.x, _spaceSize);

                    float currentHitZ = RoundPositionFloat(currentLocation.z, _spaceSize);

                    Vector3 updatedLocation = new Vector3(currentHitX, currentLocation.y + 3.0f, currentHitZ);

                    AttackSeeker atkSeeker = Instantiate(_attackSeekerPrefab, updatedLocation, Quaternion.identity).GetComponent <AttackSeeker>();

                    atkSeeker.setAtkSeekerID(_gameData.getAttackSeekers().Count);

                    _gameData.addAtkSeeker(atkSeeker);
                }
            }
        }
    }
Ejemplo n.º 2
0
 public void addAtkSeeker(AttackSeeker atkSeeker)
 {
     attackSeekers.Add(atkSeeker);
 }