Exemple #1
0
 public void  HandleAction(AgentAction _action)
 {
     if (!_action.IsFailed())
     {
         FSM.DoAction(_action);
     }
 }
Exemple #2
0
    public void HandleAction(AgentAction action)
    {
        if (action.IsFailed())
        {
            return;
        }

        if (action is AgentActionAttack)
        {
            AttackAction = action as AgentActionAttack;

            WeaponBase weapon = Weapons[CurrentWeapon];

            weapon.Fire(AttackAction.AttackDir);

            if (weapon.ClipAmmo == 0)
            {
                Owner.WorldState.SetWSProperty(E_PropKey.WeaponLoaded, false);
            }
        }
        else if (action is AgentActionReload)
        {
            WeaponBase weapon = Weapons[CurrentWeapon];
            weapon.Reload();
            Owner.WorldState.SetWSProperty(E_PropKey.WeaponLoaded, true);
        }
    }
Exemple #3
0
    public void HandleAction(AgentAction action)
    {
        //if(Owner.debugAnims) Debug.Log(Time.timeSinceLevelLoad + " " +  gameObject.name  + " handle action " + action.ToString());

        if (enabled == false || action.IsFailed())
        {
            return;
        }

        if (action is AgentActionWeaponChange)
        {
            if (Owner.IsAlive)
            {
                StartCoroutine(SwitchWeapon(action as AgentActionWeaponChange));
            }
            return;
        }

/*		//THROW_RUN_2
 *              if (action is AgentActionUseItem)
 *              {
 *                      StartCoroutine( ThrowItem(action as AgentActionUseItem) );
 *                      return;
 *              }
 */
        if (FSM.DoAction(action) == false)
        {
            action.SetFailed();
        }
    }
    public void HandleAction(AgentAction action)
    {
        if (action.IsFailed())
        {
            return;
        }

        if (action is AgentActionAttack)
        {
            AgentActionAttack a      = action as AgentActionAttack;
            WeaponBase        weapon = Weapons[CurrentWeapon];

            weapon.Fire(a.FromPos, a.AttackDir);

            PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(Owner.NetworkView.owner);
            if (ppi != null)
            {
                ppi.AddWeaponUse(CurrentWeapon);
            }
        }
        else if (action is AgentActionReload)
        {
            WeaponBase weapon = Weapons[CurrentWeapon];
            weapon.Reload();
            //            Owner.WorldState.SetWSProperty(E_PropKey.WeaponLoaded, true);
        }
    }
Exemple #5
0
    public void HandleAction(AgentAction _action)
    {
        if (_action.IsFailed())
        {
            return;
        }

        FSM.DoAction(_action);
    }
    public void HandleAction(AgentAction action)
    {
        if (action.IsFailed())
        {
            return;
        }

        if (action is AgentActionUseItem)
        {
            AgentActionUseItem = action as AgentActionUseItem;
        }
        else if (action is AgentActionAttack)
        {
            OnFire();
        }
    }
    public static void SpectatorActionHandler(AgentAction action)
    {
        if (action.IsFailed())
        {
            return;
        }

        if (action is AgentActionDeath)
        {
            if (mAutoSwitch)
            {
                mTimeFromhumanSpectatorActivation = Mathf.Min(mTimeFromhumanSpectatorActivation, 1.5f);
            }
            else
            {
                mAutoSwitch = true;

                mTimeFromhumanSpectatorActivation = 1.5f;
            }
        }
        else if (action is AgentActionAttack)
        {
            mTimeFromhumanSpectatorActivation = Mathf.Max(mTimeFromhumanSpectatorActivation, 1.5f);
        }
        else if (action is AgentActionInjury)
        {
            mTimeFromhumanSpectatorActivation = Mathf.Max(mTimeFromhumanSpectatorActivation, 2.5f);
        }
        else if (action is AgentActionMelee)
        {
            mTimeFromhumanSpectatorActivation = Mathf.Max(mTimeFromhumanSpectatorActivation, 1.75f);
        }
        else if (action is AgentActionKnockdown)
        {
            mTimeFromhumanSpectatorActivation = Mathf.Max(mTimeFromhumanSpectatorActivation, 1.75f);
        }
    }