public CharacterCommand GetByCommandTileId(int?commandtileId) { CharacterCommand characterCommand = _context.CharacterCommands .Where(x => x.CommandTileId == commandtileId && x.IsDeleted != true).SingleOrDefault(); return(characterCommand); }
public static CharacterCommand RMT_CC(RoleMotionType type) { if (type == RoleMotionType.RMT_Idle) { return(CharacterCommand.CC_Stop); } else if (type == RoleMotionType.RMT_Run) { return(CharacterCommand.CC_WalkToPoint); } else if (type == RoleMotionType.RMT_Jump) { return(CharacterCommand.CC_JumpToPoint); } else if (type == RoleMotionType.RMT_Fly) { return(CharacterCommand.CC_FlyToPoint); } string[] strArray = type.ToString().Split(new char[] { '_' }); if (strArray == null || strArray.Length < 2) { return(CharacterCommand.CC_Stop); } string rmtStr = "CC_" + strArray[1]; try { CharacterCommand cc = (CharacterCommand)System.Enum.Parse(typeof(CharacterCommand), rmtStr); return(cc); } catch { return(CharacterCommand.CC_Stop); } }
protected override async Task <CharacterCommand> GetCommandInnerAsync(MainRepository repo, IEnumerable <CountryWar> wars) { this.UpdateAvailableWars(wars); this.Character.Religion = this.Country.Religion; this.Character.From = this.Country.Religion == ReligionType.Buddhism ? CharacterFrom.Buddhism : this.Country.Religion == ReligionType.Confucianism ? CharacterFrom.Confucianism : this.Country.Religion == ReligionType.Taoism ? CharacterFrom.Taoism : CharacterFrom.Unknown; var towns = await repo.Town.GetAllAsync(); var command = new CharacterCommand { Id = 0, CharacterId = this.Character.Id, GameDateTime = this.GameDateTime, }; if (this.Town.Religion == this.Character.Religion) { command.Type = CharacterCommandType.Missionary; } else { var aroundTowns = towns.GetAroundTowns(this.Town); command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = (int)RandomService.Next(aroundTowns).Id, }); command.Type = CharacterCommandType.Move; } return(command); }
private ScenarioCommand ExecuteNext() { if (mCommandList.Length <= mCursor) { return(null); } ScenarioCommand command = mCommandList[mCursor++]; if (command is ConversationCommand) { ConversationCommand conv = command as ConversationCommand; mName = conv.Name; mContext = conv.Context; } else if (command is CharacterCommand) { CharacterCommand crt = command as CharacterCommand; SetCharacterId(crt.Position, crt.Id); } else if (command is BackgroundCommand) { BackgroundCommand bg = command as BackgroundCommand; BG = bg.Id; mBGColor = bg.BackgroundColor; } return(command); }
public bool ExecuteCommand(CharacterCommand type) { if (type == CharacterCommand.CC_None) { return(false); } Command cmd = TryGet(type); if (cmd == null) { return(false); } LastCommand = CurrentCommand; CurrentCommand = cmd; if (LastCommand != null && LastCommand.ActiveStatus == true) { LastCommand.InActive(Machine, this, cmd); } CurrentCommand.Active(Machine, this, LastCommand); if (OnChangeCommandDelegate != null) { OnChangeCommandDelegate(CurrentCommand, LastCommand); } return(true); }
public async Task <CharacterCommand> Update(CharacterCommand item) { CharacterCommand characterCommand = await _repo.Get(item.CharacterCommandId); if (characterCommand == null) { return(characterCommand); } characterCommand.Name = item.Name; characterCommand.UpdatedOn = item.UpdatedOn; characterCommand.Command = item.Command; try { _context.SaveChanges(); } catch (Exception ex) { throw ex; } return(characterCommand); }
public CharacterCommand GetById(int?id) { CharacterCommand characterCommand = _context.CharacterCommands .Where(x => x.CharacterCommandId == id && x.IsDeleted != true).SingleOrDefault(); return(characterCommand); }
public bool ExecuteCommand(CharacterCommand command) { if (MotionCommander == null) { return(false); } return(MotionCommander.ExecuteCommand(command)); }
protected virtual void SetCommandOnNoWars(CharacterCommand command) { command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = 4, }); command.Type = CharacterCommandType.Training; }
private void MoveAway() { isMoveAway = true; Vector3 start = owner.transform.position + new Vector3(0, 1, 0); Vector3 point = start + direccts[Random.Range(0, direccts.Count - 1)] * 6; owner.commands.Remove(extraCommad); extraCommad = new MoveCommand(owner, point); owner.PushCommand(extraCommad); }
public void SetPathCommand(List <Vector3> path) { if (Armament.AttackType is ArcherType) { Command = new MoveCommand(this, path); } else { Command = new RushCommand(this, path); } }
protected override async Task <CharacterCommand> GetCommandInnerAsync(MainRepository repo, IEnumerable <CountryWar> wars) { var command = new CharacterCommand { Id = 0, CharacterId = this.Character.Id, GameDateTime = this.GameDateTime, }; command.Type = CharacterCommandType.Gather; return(command); }
private AbilityStatus CheckAbilityStatus(Int32 subMenuIndex) { CharacterCommand command = CharacterCommands.Commands[_currentCommandId]; if (subMenuIndex >= command.Abilities.Length) { return(AbilityStatus.None); } Int32 abilityId = command.Abilities[subMenuIndex]; return(GetAbilityState(abilityId)); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (Instance == null) { return; } if (GUILayout.Button("Auto Generate")) { MotionMachine machine = Instance.GetMotionMachine(); if (machine == null || machine.Motions == null || machine.Motions.Count == 0) { return; } if (Instance.Commands == null) { Instance.Commands = new List <MotionCommander.Command>(); } List <Motion> motions = machine.Motions; for (int i = 0; i < motions.Count; i++) { Motion motion = motions[i]; if (motion == null) { continue; } string[] strArray = motion.Type.ToString().Split(new char[] { '_' }); if (strArray == null || strArray.Length < 2) { continue; } string tempStr = strArray[1]; if (tempStr.StartsWith("Pre") || tempStr.EndsWith("End")) { continue; } CharacterCommand commandType = Utility.RMT_CC(motion.Type); MotionCommander.Command command = Instance.TryGet(commandType); if (command == null) { command = new MotionCommander.Command(); command.Type = commandType; command.DisplayName = commandType.ToString(); command.SequentialMotions.Add(motion.Type); Instance.Add(command); } } } }
protected override async Task <CharacterCommand> GetCommandInnerAsync(MainRepository repo, IEnumerable <CountryWar> wars) { var command = new CharacterCommand { Id = 0, CharacterId = this.Character.Id, GameDateTime = this.GameDateTime, }; command.Type = CharacterCommandType.Spy; command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = (int)this.Character.TownId, }); return(command); }
public void PushCommand(CharacterCommand _command) { List <CharacterCommand> newCommands = new List <CharacterCommand>(); newCommands.Add(_command); if (commands.Count > 0) { newCommands.Add(commands[commands.Count - 1]); } else { newCommands.Add(Command); } commands = newCommands; Command = _command; }
public Command TryGet(CharacterCommand command) { if (Commands == null || Commands.Count == 0) { return(null); } for (int i = 0; i < Commands.Count; i++) { Command cmd = Commands[i]; if (cmd == null) { continue; } if (cmd.Type == command) { return(cmd); } } return(null); }
protected override async Task <CharacterCommand> GetCommandInnerAsync(MainRepository repo, IEnumerable <CountryWar> wars) { var command = new CharacterCommand { Id = 0, CharacterId = this.Character.Id, GameDateTime = this.GameDateTime, }; if ((this.GameDateTime.Month % 2 == 0 && this.Town.Commercial < this.Town.CommercialMax) || this.Town.Agriculture >= this.Town.AgricultureMax) { command.Type = CharacterCommandType.Commercial; } else { command.Type = CharacterCommandType.Agriculture; } return(command); }
protected override async Task <CharacterCommand> GetCommandInnerAsync(MainRepository repo, IEnumerable <CountryWar> wars) { this.UpdateAvailableWars(wars); var towns = await repo.Town.GetAllAsync(); var command = new CharacterCommand { Id = 0, CharacterId = this.Character.Id, GameDateTime = this.GameDateTime, }; if (this.Town.Id != this.Country.CapitalTownId) { this.InputMoveToTown(this.Country.CapitalTownId, command); return(command); } else { var availableWar = wars.FirstOrDefault(w => w.IntStartGameDate <= this.GameDateTime.ToInt() && (w.Status == CountryWarStatus.Available || w.Status == CountryWarStatus.StopRequesting)); if (availableWar != null) { command.Type = CharacterCommandType.SuperSecurity; return(command); } else if (this.Town.Security < 100) { command.Type = CharacterCommandType.Security; return(command); } else { this.SetCommandOnNoWars(command); return(command); } } }
public static CharacterCommand GenerateCharacterCommandByRmt(RoleMotionType varType) { if (varType == RoleMotionType.RMT_Idle) { return(CharacterCommand.CC_Stop); } string[] strArray = varType.ToString().Split(new char[] { '_' }); if (strArray == null || strArray.Length < 2) { return(CharacterCommand.CC_None); } string commandStr = "CC_" + strArray[1]; try { CharacterCommand command = (CharacterCommand)System.Enum.Parse(typeof(CharacterCommand), commandStr); return(command); } catch { return(CharacterCommand.CC_None); } }
public static RoleMotionType GenerateRoleMotionTypeByCharacterCommand(CharacterCommand command) { if (command == CharacterCommand.CC_None) { return(RoleMotionType.RMT_Idle); } string[] strArray = command.ToString().Split(new char[] { '_' }); if (strArray == null || strArray.Length < 2) { return(RoleMotionType.RMT_Idle); } string rmtStr = "RMT_" + strArray[1]; try { RoleMotionType rmt = (RoleMotionType)System.Enum.Parse(typeof(RoleMotionType), rmtStr); return(rmt); } catch { return(RoleMotionType.RMT_Idle); } }
public async Task <CharacterCommand> UpdateByCommandTile(CharacterCommand item) { CharacterCommand characterCommand = GetByCommandTileId(item.CommandTileId); if (characterCommand == null) { return(characterCommand); } characterCommand.Name = item.Name; characterCommand.Command = item.Command; characterCommand.UpdatedOn = DateTime.Now; try { _context.SaveChanges(); } catch (Exception ex) { throw ex; } return(characterCommand); }
private Boolean ManageTargetCommand() { BattleUnit btl = FF9StateSystem.Battle.FF9Battle.GetUnit(CurrentPlayerIndex); if ((Int32)_currentCommandId == 31 && (!_magicSwordCond.IsViviExist || _magicSwordCond.IsViviDead || _magicSwordCond.IsSteinerMini)) { FF9Sfx.FF9SFX_Play(101); ResetToReady(); return(false); } if (!_isTranceMenu && btl.IsUnderAnyStatus(BattleStatus.Trance)) { FF9Sfx.FF9SFX_Play(101); ResetToReady(); return(false); } if (_subMenuType == SubMenuType.Ability) { CharacterCommand command = CharacterCommands.Commands[_currentCommandId]; if (_currentSubMenuIndex >= command.Abilities.Length) { return(true); } AA_DATA aaData = FF9StateSystem.Battle.FF9Battle.aa_data[PatchAbility(command.Abilities[_currentSubMenuIndex])]; Int32 mpCost = ff9abil.FF9Abil_GetEnableSA(btl.PlayerIndex, AbilSaMpHalf) ? aaData.MP >> 1 : aaData.MP; if (btl.CurrentMp < mpCost) { FF9Sfx.FF9SFX_Play(101); DisplayAbility(); SetTargetVisibility(false); ClearModelPointer(); SetAbilityPanelVisibility(true, true); return(false); } if ((aaData.Category & 2) != 0 && btl.IsUnderAnyStatus(BattleStatus.Silence)) { FF9Sfx.FF9SFX_Play(101); DisplayAbility(); SetTargetVisibility(false); ClearModelPointer(); SetAbilityPanelVisibility(true, true); return(false); } } if ((_subMenuType == SubMenuType.Item || _subMenuType == SubMenuType.Throw) && ff9item.FF9Item_GetCount(_itemIdList[_currentSubMenuIndex]) == 0) { FF9Sfx.FF9SFX_Play(101); DisplayItem(_subMenuType == SubMenuType.Throw); SetTargetVisibility(false); ClearModelPointer(); SetItemPanelVisibility(true, true); return(false); } return(true); }
public async Task <CharacterCommand> Create(CharacterCommand item) { return(await _repo.Add(item)); }
protected virtual void SetCommandOnNoWars(CharacterCommand command) { command.Type = CharacterCommandType.Wall; }
public override Boolean OnKeyConfirm(GameObject go) { if (!base.OnKeyConfirm(go) || _hidingHud) { return(true); } if (ButtonGroupState.ActiveGroup == CommandGroupButton) { FF9Sfx.FF9SFX_Play(103); _currentCommandIndex = (CommandMenu)go.transform.GetSiblingIndex(); _currentCommandId = (UInt32)GetCommandFromCommandIndex(_currentCommandIndex, CurrentPlayerIndex); _commandCursorMemorize[CurrentPlayerIndex] = _currentCommandIndex; _subMenuType = SubMenuType.Normal; if (IsDoubleCast && _doubleCastCount < 2) { ++_doubleCastCount; } switch (_currentCommandIndex) { case CommandMenu.Attack: SetCommandVisibility(false, false); SetTargetVisibility(true); break; case CommandMenu.Defend: _targetCursor = 0; SendCommand(ProcessCommand(CurrentPlayerIndex, CursorGroup.Individual)); SetIdle(); break; case CommandMenu.Ability1: case CommandMenu.Ability2: //int num = currentCommandIndex != CommandMenu.Ability2 ? 0 : 1; CharacterCommand ff9Command = CharacterCommands.Commands[_currentCommandId]; if (ff9Command.Type == CharacterCommandType.Normal) { _subMenuType = SubMenuType.Normal; SetCommandVisibility(false, false); SetTargetVisibility(true); break; } if (ff9Command.Type == CharacterCommandType.Ability) { _subMenuType = SubMenuType.Ability; DisplayAbility(); SetCommandVisibility(false, false); SetAbilityPanelVisibility(true, false); break; } if (ff9Command.Type == CharacterCommandType.Throw) { _subMenuType = SubMenuType.Throw; DisplayItem(true); SetCommandVisibility(false, false); SetItemPanelVisibility(true, false); } break; case CommandMenu.Item: DisplayItem(false); SetCommandVisibility(false, false); SetItemPanelVisibility(true, false); break; case CommandMenu.Change: _targetCursor = 0; CommandDetail command = ProcessCommand(CurrentPlayerIndex, CursorGroup.Individual); if (_isManualTrance) { command.SubId = 96; // Trance } SendCommand(command); SetIdle(); break; } } else if (ButtonGroupState.ActiveGroup == TargetGroupButton) { FF9Sfx.FF9SFX_Play(103); if (_cursorType == CursorGroup.Individual) { for (Int32 i = 0; i < _matchBattleIdEnemyList.Count; i++) { if (i < _targetPanel.Enemies.Count && _targetPanel.Enemies[i].GameObject == go) { CheckDoubleCast(_matchBattleIdEnemyList[i], _cursorType); return(true); } } for (Int32 i = 0; i < _matchBattleIdPlayerList.Count; i++) { if (i < _targetPanel.Players.Count && _targetPanel.Players[i].GameObject == go) { CheckDoubleCast(_matchBattleIdPlayerList[i], _cursorType); return(true); } } } else if (_cursorType == CursorGroup.AllPlayer || _cursorType == CursorGroup.AllEnemy || _cursorType == CursorGroup.All) { CheckDoubleCast(-1, _cursorType); } } else if (ButtonGroupState.ActiveGroup == AbilityGroupButton) { if (CheckAbilityStatus(go.GetComponent <RecycleListItem>().ItemDataIndex) == AbilityStatus.Enable) { FF9Sfx.FF9SFX_Play(103); _currentSubMenuIndex = go.GetComponent <RecycleListItem>().ItemDataIndex; if (_currentCommandIndex == CommandMenu.Ability1) { _ability1CursorMemorize[CurrentPlayerIndex] = _currentSubMenuIndex; } else { _ability2CursorMemorize[CurrentPlayerIndex] = _currentSubMenuIndex; } SetAbilityPanelVisibility(false, false); SetTargetVisibility(true); } else { FF9Sfx.FF9SFX_Play(102); } } else if (ButtonGroupState.ActiveGroup == ItemGroupButton) { if (_itemIdList[_currentSubMenuIndex] != Byte.MaxValue) { FF9Sfx.FF9SFX_Play(103); _currentSubMenuIndex = go.GetComponent <RecycleListItem>().ItemDataIndex; _itemCursorMemorize[CurrentPlayerIndex] = _currentSubMenuIndex; SetItemPanelVisibility(false, false); SetTargetVisibility(true); } else { FF9Sfx.FF9SFX_Play(102); } } return(true); }
protected override async Task <CharacterCommand> GetCommandInnerAsync(MainRepository repo, IEnumerable <CountryWar> wars) { this.UpdateAvailableWars(wars); var towns = await repo.Town.GetAllAsync(); var command = new CharacterCommand { Id = 0, CharacterId = this.Character.Id, GameDateTime = this.GameDateTime, }; if (this.Town.Id != this.Country.CapitalTownId) { this.InputMoveToTown(this.Country.CapitalTownId, command); return(command); } else { var targetCountryIds = await this.GetWarTargetCountriesAsync(repo, wars); if (targetCountryIds.Any()) { var targetTowns = towns .GetAroundTowns(this.Town) .Where(t => targetCountryIds.Contains(t.CountryId)); var currentTownDefenders = await repo.Town.GetDefendersAsync(this.Town.Id); var isDefending = currentTownDefenders.Any(d => d.Character.Id == this.Character.Id); if (isDefending && targetTowns.Any() && this.Character.SoldierNumber > 25) { // 攻撃 var targetTownsData = new List <(Town Town, IEnumerable <Character> Defenders)>(); foreach (var town in targetTowns) { var defenders = await repo.Town.GetDefendersAsync(town.Id); targetTownsData.Add(((Town)town, defenders.Select(td => td.Character))); } var targetTown = targetTownsData.OrderBy(td => td.Defenders.Count()).First(); command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = (int)targetTown.Town.Id, }); command.Type = CharacterCommandType.Battle; return(command); } else if ((await repo.System.GetAsync()).IsBattleRoyaleMode && !targetTowns.Any()) { // 攻撃先と隣接していない、かつ全国戦争中 var canAttack = await this.MoveToMyCountryTownNextToCountryAsync(repo, towns, t => true, t => t.People *t.Security, targetCountryIds, command); if (!canAttack) { // 攻撃先と飛び地 command.Type = CharacterCommandType.Training; command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = 2, }); } return(command); } else { if (this.Character.Money > 30000 && ((isDefending && this.Character.SoldierNumber < 30) || (!isDefending && this.Character.SoldierNumber <= 0))) { // 兵を補充 if (this.CanSoldierForce) { this.Town.People = (int)Math.Max(this.Town.People, this.Character.Leadership * Config.SoldierPeopleCost + 500); this.Town.Security = Math.Max(this.Town.Security, (short)(this.Character.Leadership / 10 + 1)); await repo.SaveChangesAsync(); } command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = (int)this.SoldierType, }); command.Parameters.Add(new CharacterCommandParameter { Type = 2, NumberValue = this.Character.Leadership, }); command.Parameters.Add(new CharacterCommandParameter { Type = 3, NumberValue = 0, }); command.Type = CharacterCommandType.Soldier; return(command); } else if (!isDefending && this.Character.Money >= 30000) { // 守備してなければ守備 command.Type = CharacterCommandType.Defend; return(command); } else { // 壁塗り command.Type = CharacterCommandType.Wall; return(command); } } } else { this.SetCommandOnNoWars(command); return(command); } } }
protected override async Task <CharacterCommand> GetCommandInnerAsync(MainRepository repo, IEnumerable <CountryWar> wars) { this.UpdateAvailableWars(wars); var isNeedSoldier = this.Character.SoldierNumber < Math.Max(this.Character.Leadership / 10, 20); var towns = await repo.Town.GetAllAsync(); var command = new CharacterCommand { Id = 0, CharacterId = this.Character.Id, GameDateTime = this.GameDateTime, Type = CharacterCommandType.None, }; if (this.Town.CountryId != this.Character.CountryId || ((this.Town.People < 3000 || this.Town.Security < 20) && isNeedSoldier && !this.CanSoldierForce)) { // 徴兵のための都市に移動する await this.MoveToMyCountryTownAsync(repo, towns, t => t.People > 3000 && t.Security >= 20, t => t.People *t.Security, command); return(command); } if (isNeedSoldier) { if (this.CanSoldierForce) { this.Town.People = (int)Math.Max(this.Town.People, this.Character.Leadership * Config.SoldierPeopleCost + 500); this.Town.Security = Math.Max(this.Town.Security, (short)(this.Character.Leadership / 10 + 1)); await repo.SaveChangesAsync(); } command.Type = CharacterCommandType.Soldier; command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = (int)this.FindSoldierType(), }); command.Parameters.Add(new CharacterCommandParameter { Type = 2, NumberValue = this.Character.Leadership, }); command.Parameters.Add(new CharacterCommandParameter { Type = 3, NumberValue = 0, }); return(command); } if (this.Town.Id == this.Country.CapitalTownId || (this.Town.People > 3000 && this.Town.Security >= 40)) { var currentDefenders = await repo.Town.GetDefendersAsync(this.Town.Id); if (!currentDefenders.Any()) { command.Type = CharacterCommandType.Defend; return(command); } } var targetCountryIds = await this.GetWarTargetCountriesAsync(repo, wars); if (targetCountryIds.Any()) { var targetTowns = towns .GetAroundTowns(this.Town) .Where(t => targetCountryIds.Contains(t.CountryId)); if (!targetTowns.Any()) { // 攻撃先と隣接していない var canAttack = await this.MoveToMyCountryTownNextToCountryAsync(repo, towns, t => true, t => t.People *t.Security, targetCountryIds, command); if (!canAttack) { // 攻撃先と飛び地 command.Type = CharacterCommandType.Training; command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = 1, }); } return(command); } else { var targetTownsData = new List <(Town Town, IEnumerable <Character> Defenders)>(); foreach (var town in targetTowns) { var defenders = await repo.Town.GetDefendersAsync(town.Id); targetTownsData.Add(((Town)town, defenders.Select(td => td.Character))); } var targetTown = targetTownsData.OrderBy(td => td.Defenders.Count()).First(); // 侵攻 command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = (int)targetTown.Town.Id, }); command.Type = CharacterCommandType.Battle; return(command); } } else { var readyWar = wars .OrderBy(w => w.IntStartGameDate) .FirstOrDefault(w => w.IntStartGameDate <= this.GameDateTime.ToInt() + 3 && w.Status == CountryWarStatus.InReady || w.Status == CountryWarStatus.StopRequesting); if (readyWar != null) { // 戦争準備中の国に隣接してないなら移動する if (!towns.GetAroundTowns(this.Town).Any(t => t.CountryId != readyWar.InsistedCountryId && t.CountryId != readyWar.RequestedCountryId)) { var canAttack = await this.MoveToMyCountryTownNextToCountryAsync(repo, towns, t => t.People > 3000 && t.Security >= 40, t => t.People *t.Security, readyWar.InsistedCountryId == this.Country.Id?readyWar.RequestedCountryId : readyWar.InsistedCountryId, command); if (!canAttack) { // 攻撃先と飛び地 command.Type = CharacterCommandType.Training; command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = 1, }); } return(command); } } if (this.Character.Proficiency < 100) { command.Type = CharacterCommandType.SoldierTraining; } else { command.Type = CharacterCommandType.Training; command.Parameters.Add(new CharacterCommandParameter { Type = 1, NumberValue = 1, }); } return(command); } }
public void Appear(Vector3 position, CharacterCommand command = CharacterCommand.CC_Appear) { Active(true, GameScene.LAYER.Player); SetPosition(position); ExecuteCommand(command); }
protected void Start() { EventStart.Invoke(this); health?.EventDie.AddListener(OnDie); Command = new GuardCommand(this); }