コード例 #1
0
    protected override void Initialize(FSMEvent ev = null)
    {
        _eventInjury = ev as AnimFSMEventInjury;

        string animName = Agent.AnimSet.GetInjuryAnim(_eventInjury.fromWeapon, _eventInjury.damageType);

        Phenix.Unity.Utilities.AnimationTools.PlayAnim(Agent.AnimEngine, animName, 0.1f);

        _endOfStateTime             = Agent.AnimEngine[animName].length + Time.timeSinceLevelLoad;
        Agent.BlackBoard.motionType = MotionType.NONE;
        _moveTime        = Agent.AnimEngine[animName].length * 0.5f;
        _currentMoveTime = 0;

        if (_eventInjury.attacker != null && Agent.IsPlayer == false)
        {
            Vector3 dir = _eventInjury.attacker.Position - Agent.Transform.position;
            dir.Normalize();
            _finalRotation.SetLookRotation(dir);
            _startRotation    = Agent.Transform.rotation;
            _rotationProgress = 0;
            _rotationOk       = false;
        }
        else
        {
            _rotationOk = true;
        }

        _impuls     = _eventInjury.impuls * 10;
        _positionOK = _impuls == Vector3.zero;
        Agent.BlackBoard.motionType = MotionType.INJURY;
    }
コード例 #2
0
 void SendInjuryEvent()
 {
     _eventInjury            = AnimFSMEventInjury.pool.Get();
     _eventInjury.damageType = Agent.BlackBoard.damageType;
     _eventInjury.fromWeapon = Agent.BlackBoard.attackerWeapon;
     _eventInjury.attacker   = Agent.BlackBoard.Attacker;
     _eventInjury.impuls     = Agent.BlackBoard.impuls;
     Agent.FSMComponent.SendEvent(_eventInjury);
 }
コード例 #3
0
 public override void Reset()
 {
     base.Reset();
     _eventInjury         = null;
     _eventKnockDown      = null;
     _eventDeath          = null;
     _attacker            = null;
     _attackerRepeatCount = 0;
     _damageResultType    = DamageResultType.NONE;
 }
コード例 #4
0
    void SendEvent()
    {
        switch (_damageResultType)
        {
        case DamageResultType.INJURY:
            if (_eventKnockDown != null)
            {
                _eventKnockDown.Release();
                _eventKnockDown = null;
            }
            if (_eventDeath != null)
            {
                _eventDeath.Release();
                _eventDeath = null;
            }
            SendInjuryEvent();
            break;

        case DamageResultType.KNOCK_DOWN:
            if (_eventInjury != null)
            {
                _eventInjury.Release();
                _eventInjury = null;
            }
            if (_eventDeath != null)
            {
                _eventDeath.Release();
                _eventDeath = null;
            }
            SendKnockDownEvent();
            break;

        case DamageResultType.DEATH:
            if (_eventKnockDown != null)
            {
                _eventKnockDown.Release();
                _eventKnockDown = null;
            }
            if (_eventInjury != null)
            {
                _eventInjury.Release();
                _eventInjury = null;
            }
            SendDeathEvent();
            break;

        default:
            return;
        }
    }
コード例 #5
0
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     if (_eventInjury != null)
     {
         _eventInjury.Release();
         _eventInjury = null;
     }
     if (_eventKnockDown != null)
     {
         _eventKnockDown.Release();
         _eventKnockDown = null;
     }
     if (_eventDeath != null)
     {
         _eventDeath.Release();
         _eventDeath = null;
     }
     base.OnExit(ws);
 }