Ejemplo n.º 1
0
    protected override void Initialize(FSMEvent ev = null)
    {
        _eventRotate = ev as AnimFSMEventMoveRotate;

        _rotationProgress = 0;
        _startRotation    = Agent.Transform.rotation;
        Vector3 finalDir;

        if (_eventRotate.target != null)
        {
            finalDir = (_eventRotate.target.Position + (_eventRotate.target.BlackBoard.moveDir *
                                                        _eventRotate.target.BlackBoard.speed * 0.5f)) - Agent.Transform.position;
            finalDir.Normalize();
        }
        else if (_eventRotate.direction != Vector3.zero)
        {
            finalDir = _eventRotate.direction;
        }
        else
        {
            finalDir = Agent.Transform.forward;
        }

        _animName = Agent.AnimSet.GetMoveAnim(Agent.BlackBoard.motionType, MoveType.FORWARD,
                                              Agent.BlackBoard.weaponSelected, Agent.BlackBoard.weaponState);
        AnimationTools.PlayAnim(Agent.AnimEngine, _animName, 0.2f);

        _finalRotation.SetLookRotation(finalDir);
    }
Ejemplo n.º 2
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     if (_eventRotate != null)
     {
         _eventRotate.Release();
         _eventRotate = null;
     }
     base.OnExit(ws);
 }
Ejemplo n.º 3
0
 void SendEvent()
 {
     _eventRotate        = AnimFSMEventMoveRotate.pool.Get();
     _eventRotate.target = Agent.BlackBoard.desiredTarget;
     Agent.FSMComponent.SendEvent(_eventRotate);
 }
Ejemplo n.º 4
0
 public override void Reset()
 {
     base.Reset();
     _eventRotate = null;
 }