public void Update(StateContex contex) { contex.weapon = bag.GetNowWeapon(); soldierState = soldierState.NextState(_this, animatorHandler, contex); contex.characterType = charactType; contex.weapon.Update(_this, animatorHandler, contex); }
private void SetState(SoldierStateBase state) { soldierState = state; contex.Clear(); contex.weapon = bag.GetNowWeapon(); soldierState.Enter(_this, animatorHandler, contex); }
public void Clear() { weapon = null; preState = null; for (int i = 0; i < contexes.Length; i++) { contexes[i] = -1; } }
public Soldier(GameObject soldier, AnimatorHandler animatorHandler, SoldierStateBase state, CharacterType charactType, int userID, int roomID) { this._this = soldier; this.animatorHandler = animatorHandler; this.charactType = charactType; this.userID = userID; this.roomID = roomID; isAlive = true; bag = new WeaponBag(); SetWeaponAndState(bag.GetNowWeapon(), bag.GetNowWeaponIndex(), state); roleState = new RoleState(false); EventMgr.Instance.AddEventListener(EventName.PLAYER_CHANGE_WEAPON + "#" + userID.ToString(), ChangeWeaponCmd); }
public void SetWeaponAndState(WeaponBase weapon, int pos, SoldierStateBase state) { SetWeapon(weapon, pos, charactType); SetState(state); }