//-------------------------------------------------------------------------------------[] private void GenerateUpdatePackAndSetNewModel( CombatModel newCombatModel, IEnumerable <ICombatEvent> events) { GenerateUpdatePack(newCombatModel, events); SetNewModel(newCombatModel); }
public void SetCombatObj(CombatObj combatObj) { this.combatObj = combatObj; CombatModel data = CombatTable.Instance.GetCombatData(combatObj.Type); //Sprite iconImage.sprite = data.Sprite; //Timer if (combatObj.Timer <= 0) { cooldownText.text = ""; } else { cooldownText.text = combatObj.Timer.ToString("F0"); } //Stack stackText.text = combatObj.Stack.ToString(); if (combatObj.IsActive) { iconImage.material = null; } else { iconImage.material = grayscaleMaterial; } }
public PlayerModel(string name = "Default character", CombatModel combat = null, SkillsModel skills = null, EquipedModel equiped = null) { this.Name = name; if (combat != null) { Combat = combat; } else { Combat = new CombatModel(); } if (skills != null) { Skills = skills; } else { Skills = new SkillsModel(); } if (equiped != null) { Equiped = Equiped; } else { Equiped = new EquipedModel(); } }
//-------------------------------------------------------------------------------------[] private void SetNewFullModel(CombatModel newCombatModel) { _combatUpdatePacks.Clear(); GenerateUpdatePackAndSetNewModel(newCombatModel, GetNewCombatModelEvents()); if (!_isFirstFullCombatModelReceived) { PlayerReady(); } }
//-------------------------------------------------------------------------------------[] private void SetNewModel(CombatModel newCombatModel) { _combatModel = newCombatModel; if (_startCombatTime == DateTime.MinValue && _combatModel.MatchTimeInSeconds.HasValue && (_combatModel.MatchTimeInSeconds.Value > 0 || (IsCombatInProcess || _combatModel.StartingMatch))) { _startCombatTime = DateTime.Now.AddSeconds(-_combatModel.MatchTimeInSeconds.Value); } }
//-------------------------------------------------------------------------------------[] private void CheckRemainingTurnDuration(CombatModel newCombatModel) { if (newCombatModel.RemainingTurnDuration.HasValue) { SetModelUpdateTime(); } else { newCombatModel.RemainingTurnDuration = _combatModel.RemainingTurnDuration; } }
public CombatModel GetCombatData(CombatType type) { if (cache.ContainsKey(type)) { return(cache[type]); } else { CombatModel data = table.First(x => x.Type == type); cache.Add(data.Type, data); return(data); } }
public async Task <ActionResult> Fight(Guid?id) { if (id == null) { return(RedirectToAction("Index", "User")); } var player1 = await UserFacade.GetUserAccordingToUsernameAsync(User.Identity.Name); var player2 = await UserFacade.GetAsync(id.GetValueOrDefault()); var model = new CombatModel() { Player1 = player1, Player2 = player2 }; return(View(model)); }
public CombatData(CombatModel combat, bool canFlee) { if (combat.combatData == null) { combat.combatData = this.combatData = new CombatDataModel(); combat.combatData.canFlee = canFlee; Init(); } this.combatData = combat.combatData; this.doubleSelectionState = PlayerModels.CombatDataModels.CombatDataModel.DoubleSelectionState.None; if (this.combatData.firstTurnOver == null) { this.combatData.firstTurnOver = new List <CombatDataModel.TurnOverModel>(); } }
public string getAttackRessult(PlayerModel deffender) { int deffender_def_roll = CombatModel.Deffend(deffender, FighterCombat); return(CombatModel.Attack(Fighter, deffender_def_roll)); }
public void InitializeCombat(AbstractPlayerCharacter PC, AbstractMonster Monster, AbstractEnvironment Environment) { SetModelState(ModelState.Combat); combat_model = new CombatModel(PC, Monster, Environment); }