コード例 #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();
 }
コード例 #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);
    }
コード例 #3
0
 public void EndPath()
 {
     _landingPath.Finialized();
 }
コード例 #4
0
 public void EndPath()
 {
     _flightpath.Finialized();
 }