//-------------------------------------------------------------------------------------[]
 private void GenerateUpdatePackAndSetNewModel(
     CombatModel newCombatModel,
     IEnumerable <ICombatEvent> events)
 {
     GenerateUpdatePack(newCombatModel, events);
     SetNewModel(newCombatModel);
 }
示例#2
0
    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;
        }
    }
示例#3
0
 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;
     }
 }
示例#7
0
 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);
     }
 }
示例#8
0
        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));
        }
示例#9
0
        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>();
            }
        }
示例#10
0
        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);
 }