Ejemplo n.º 1
0
    private void _createPoints()
    {
        Vector3 targetDirection;

        if (!PhotonNetwork.isMasterClient)
        {
            _laneOffset = -_laneOffset;
        }

        if (EnemyMothership != null)
        {
            targetDirection = EnemyMothership.GetTransform().position - _transform.position;
        }
        else
        {
            targetDirection = new Vector3(0, 30, 0);
        }

        float stepLength = targetDirection.magnitude / _pointsCount;

        _orbitPoints    = new Vector3[_pointsCount];
        _orbitPoints[0] = _transform.position + _laneOffset * 3 * Vector3.right;
        for (int i = 1; i < _pointsCount; i++)
        {
            float dx = -_laneOffset * ((float)_pointsCount / 2 - i) / 2.2f;
            _orbitPoints[i] = _orbitPoints[i - 1] + targetDirection.normalized * stepLength - dx * Vector3.right;
        }
    }
Ejemplo n.º 2
0
    private void _updateTarget()
    {
        if (EnemyMothership == null)
        {
            return;
        }
        _ships = EnemyMothership.GetShips();
        for (int shipI = 0; shipI < _ships.Count; shipI++)
        {
            if (_ships[shipI] == null)
            {
                continue;
            }

            if ((_ships[shipI].transform.position - _transform.position).magnitude > _attackDistance)
            {
                continue;
            }
            _target     = _ships[shipI].transform;
            _shipTarget = _ships[shipI];

            return;
        }
    }