void SendEvent()
    {
        switch (_damageResultType)
        {
        case DamageResultType.INJURY:
            if (_eventDeath != null)
            {
                _eventDeath.Release();
                _eventDeath = null;
            }
            SendInjuryEvent();
            break;

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

        default:
            return;
        }
    }
 void SendDeathEvent()
 {
     _eventDeath            = AnimFSMEventDeath.pool.Get();
     _eventDeath.damageType = Agent.BlackBoard.damageType;
     _eventDeath.fromWeapon = Agent.BlackBoard.attackerWeapon;
     _eventDeath.attacker   = Agent.BlackBoard.Attacker;
     _eventDeath.impuls     = Agent.BlackBoard.impuls;
     Agent.FSMComponent.SendEvent(_eventDeath);
 }
Exemplo n.º 3
0
 public override void Reset()
 {
     base.Reset();
     _eventInjury         = null;
     _eventKnockDown      = null;
     _eventDeath          = null;
     _attacker            = null;
     _attackerRepeatCount = 0;
     _damageResultType    = DamageResultType.NONE;
 }
 public override void Reset()
 {
     base.Reset();
     _injuryPhrase        = 0;
     _eventInjury         = null;
     _eventDeath          = null;
     _eventAttack         = null;
     _attacker            = null;
     _attackerRepeatCount = 0;
     _damageResultType    = DamageResultType.NONE;
     _startTrailTimer     = 0;
 }
Exemplo n.º 5
0
 public override bool OnEvent(FSMEvent ev)
 {
     if (ev is AnimFSMEventKnockDown)
     {
         (ev as AnimFSMEventKnockDown).IsFinished = true;
         return(true);
     }
     if (ev is AnimFSMEventDeath)
     {
         _eventDeath = ev as AnimFSMEventDeath;
         InitializeDeath();
         return(true);
     }
     return(false);
 }
Exemplo n.º 6
0
    protected override void Initialize(FSMEvent ev = null)
    {
        _eventDeath = ev as AnimFSMEventDeath;

        string animName = Agent.AnimSet.GetDeathAnim(_eventDeath.fromWeapon, _eventDeath.damageType);

        Phenix.Unity.Utilities.Tools.PlayAnimation(Agent.AnimEngine, animName, 0.1f);

        Agent.BlackBoard.motionType = MotionType.NONE;
        _startPosition = Agent.Transform.position;

        if (_eventDeath.attacker != null)
        {
            //_finalPosition = _startPosition + _eventDeath.attacker.Forward;
            _finalPosition = _startPosition + _eventDeath.impuls;

            _startRotation = Agent.Transform.rotation;
            //_finalRotation.SetLookRotation(-_eventDeath.attacker.Forward);
            if (_eventDeath.damageType == DamageType.BACK)
            {
                _finalRotation.SetLookRotation(_eventDeath.attacker.Forward);
            }
            else if (_eventDeath.damageType == DamageType.FRONT)
            {
                _finalRotation.SetLookRotation(-_eventDeath.attacker.Forward);
            }

            _positionOK       = false;
            _rotationOk       = false;
            _rotationProgress = 0;
        }
        else
        {
            _finalPosition = _startPosition + _eventDeath.impuls;

            _positionOK = false;
            _rotationOk = true;
        }

        _curMoveTime = 0;
        _moveTime    = Agent.AnimEngine[animName].length * 0.6f;

        //Owner.Invoke("SpawnBlood", AnimEngine[animName].length);
        Agent.BlackBoard.motionType = MotionType.DEATH;
        Agent.DisableCollisions();
    }
Exemplo n.º 7
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);
 }
 public override void OnExit(Phenix.Unity.AI.WorldState ws)
 {
     Agent.BlackBoard.invulnerable = false;
     if (_eventInjury != null)
     {
         _eventInjury.Release();
         _eventInjury = null;
     }
     if (_eventDeath != null)
     {
         _eventDeath.Release();
         _eventDeath = null;
     }
     if (_eventAttack != null)
     {
         _eventAttack.Release();
         _eventAttack = null;
     }
     base.OnExit(ws);
 }