/// <summary> /// This procedure display the equipment abilities points /// </summary> public void LoadEquipementsAbilities() { if (AttackText != null) { AttackText.text = CharactersDatas.GetAttack().ToString(); } if (MagicText != null) { MagicText.text = CharactersDatas.GetMagic().ToString(); } if (DefenseText != null) { DefenseText.text = CharactersDatas.GetDefense().ToString(); } if (MagicDefenseText != null) { MagicDefenseText.text = CharactersDatas.GetMagicDefense().ToString(); } }
/// <summary> /// Players the action. /// </summary> public void PlayerAction() { var enemyCharacterdatas = selectedEnemy.GetComponent <EnemyCharacterDatas> (); int calculatedDamage = 0; if (enemyCharacterdatas != null && selectedPlayerDatas != null) { switch (battlAction) { case EnumBattleAction.Weapon: Sequence actions = new Sequence(new SequenceParms()); TweenParms parms = new TweenParms().Prop("position", selectedEnemy.transform.position - new Vector3(SpaceBetweenCharacterAndEnemy, 0, 0)).Ease(EaseType.EaseOutQuart); TweenParms parmsResetPlayerPosition = new TweenParms().Prop("position", selectedPlayer.transform.position).Ease(EaseType.EaseOutQuart); actions.Append(HOTween.To(selectedPlayer.transform, 0.5f, parms)); actions.Append(HOTween.To(selectedPlayer.transform, 0.5f, parmsResetPlayerPosition)); actions.Play(); calculatedDamage = BattlePanels.SelectedWeapon.Attack + selectedPlayerDatas.GetAttack() - enemyCharacterdatas.Defense; calculatedDamage = Mathf.Clamp(calculatedDamage, 0, calculatedDamage); enemyCharacterdatas.HP = Mathf.Clamp(enemyCharacterdatas.HP - calculatedDamage, 0, enemyCharacterdatas.HP - calculatedDamage); ShowPopup("-" + calculatedDamage.ToString(), selectedEnemy.transform.position); selectedEnemy.BroadcastMessage("SetHPValue", enemyCharacterdatas.MaxHP <= 0?0 : enemyCharacterdatas.HP * 100 / enemyCharacterdatas.MaxHP); Destroy(Instantiate(WeaponParticleEffect, selectedEnemy.transform.localPosition, Quaternion.identity), 1.5f); SoundManager.WeaponSound(); selectedPlayer.SendMessage("Animate", EnumBattleState.Attack.ToString()); selectedEnemy.SendMessage("Animate", EnumBattleState.Hit.ToString()); break; case EnumBattleAction.Magic: calculatedDamage = BattlePanels.SelectedSpell.Attack + selectedPlayerDatas.GetMagic() - enemyCharacterdatas.MagicDefense; calculatedDamage = Mathf.Clamp(calculatedDamage, 0, calculatedDamage); enemyCharacterdatas.HP = Mathf.Clamp(enemyCharacterdatas.HP - calculatedDamage, 0, enemyCharacterdatas.HP - calculatedDamage); selectedPlayerDatas.MP = Mathf.Clamp(selectedPlayerDatas.MP - BattlePanels.SelectedSpell.ManaAmount, 0, selectedPlayerDatas.MP - BattlePanels.SelectedSpell.ManaAmount); ShowPopup(calculatedDamage.ToString(), selectedEnemy.transform.localPosition); ShowPopup("-" + calculatedDamage.ToString(), selectedEnemy.transform.position); selectedEnemy.BroadcastMessage("SetHPValue", enemyCharacterdatas.MaxHP <= 0?0 : enemyCharacterdatas.HP * 100 / enemyCharacterdatas.MaxHP); selectedPlayer.BroadcastMessage("SetMPValue", selectedPlayerDatas.MaxMP <= 0 ? 0 : selectedPlayerDatas.MP * 100 / selectedPlayerDatas.MaxMP); var ennemyEffect = Resources.Load <GameObject>(Settings.PrefabsPath + BattlePanels.SelectedSpell.ParticleEffect); Destroy(Instantiate(ennemyEffect, selectedEnemy.transform.localPosition, Quaternion.identity), 0.5f); var playerEffect = Resources.Load <GameObject>(Settings.PrefabsPath + Settings.MagicAuraEffect); Destroy(Instantiate(playerEffect, selectedPlayer.transform.localPosition, Quaternion.identity), 0.4f); SoundManager.StaticPlayOneShot(BattlePanels.SelectedSpell.SoundEffect, Vector3.zero); selectedPlayer.SendMessage("Animate", EnumBattleState.Magic.ToString()); selectedEnemy.SendMessage("Animate", EnumBattleState.Hit.ToString()); break; case EnumBattleAction.Item: calculatedDamage = BattlePanels.SelectedItem.Attack - enemyCharacterdatas.MagicDefense; calculatedDamage = Mathf.Clamp(calculatedDamage, 0, calculatedDamage); enemyCharacterdatas.HP = Mathf.Clamp(enemyCharacterdatas.HP - calculatedDamage, 0, enemyCharacterdatas.HP - calculatedDamage); ShowPopup("-" + calculatedDamage.ToString(), selectedEnemy.transform.position); selectedEnemy.BroadcastMessage("SetHPValue", enemyCharacterdatas.HP * 100 / enemyCharacterdatas.MaxHP); Destroy(Instantiate(MagicParticleEffect, selectedEnemy.transform.localPosition, Quaternion.identity), 1.7f); SoundManager.ItemSound(); selectedPlayer.SendMessage("Animate", EnumBattleState.Magic.ToString()); selectedEnemy.SendMessage("Animate", EnumBattleState.Hit.ToString()); break; default: break; } } if (enemyCharacterdatas.HP <= 0) { KillCharacter(selectedEnemy); } //selectedPlayer.SendMessage ("ChangeEnumCharacterState", battlection); selectedEnemy = null; NextBattleSequence(); }