Exemplo n.º 1
0
 private void Awake()
 {
     _landingPath = new Flightpath(transform.position);
     _landingPath.lookAheadDistance = 8f;
     for (int i = 0; i < _pathSegements.Length; i++)
     {
         _landingPath.AddPosition(_pathSegements[i] + transform.position);
     }
     _landingPath.drawPath          = true;
     _landingPath.disposeOnComplete = false;
     _landingPath.onPathExited     += OnExitedPath;
     _landingPath.Finialized();
 }
Exemplo n.º 2
0
    private void Spawn()
    {
        float angle = ((Mathf.PI * 2) * Random.value);
        float sin   = Mathf.Sin(angle);
        float cos   = Mathf.Cos(angle);

        // Pick a spawn position
        Vector3 spawnPosition = _root.position;

        spawnPosition.x += _radius * sin;
        spawnPosition.z += _radius * cos;
        GameObject go = _factory.CreateRandomPlane(spawnPosition, Quaternion.identity);

        go.transform.SetParent(_root);

        // Grab our directable component
        IDirectable iDirectable = go.GetComponent <IDirectable>();
        // Set our primary travel position
        Vector3 primaryTravelPosition = _root.position;

        primaryTravelPosition.x += (_radius - _primaryTargetRadiusOffset) * sin;
        primaryTravelPosition.z += (_radius - _primaryTargetRadiusOffset) * cos;
        primaryTravelPosition.y += _primaryTargetHeightOffset;

        // Secondary Point
        angle = ((Mathf.PI * 2) * Random.value);
        Vector3 holdingPosition = _playerTransform.position;
        float   hpRadius        = Random.value * _holdingPositionRadius * _playerTransform.scale;

        holdingPosition.x += sin * hpRadius;
        holdingPosition.z += cos * hpRadius;

        Flightpath flightPath = new Flightpath(primaryTravelPosition);

        flightPath.drawPath = false;
        flightPath.AddPosition(holdingPosition);
        flightPath.Finialized();
        iDirectable.AssignPath(flightPath, true);
    }
Exemplo n.º 3
0
 public void AddPathPosition(Vector3 position)
 {
     _landingPath.AddPosition(position);
     UpdateLineRenderer();
 }
 public void AddPathPosition(Vector3 position)
 {
     _flightpath.AddPosition(position);
 }