Exemplo n.º 1
0
//		public int maxHealthChangeFromTriggeredSkill;
//		public int hitChangeFromTriggeredSkill;
//		public int manaChangeFromTriggeredSkill;
//		public int attackChangeFromTriggeredSkill;
//		public int attackSpeedChangeFromTriggeredSkill;
//		public int armorChangeFromTriggeredSkill;
//		public int magicResistChangeFromTriggeredSkill;
//		public int dodgeChangeFromTriggeredSkill;
//		public int critChangeFromTriggeredSkill;

//		public float maxHealthChangeScalerFromTriggeredSkill;
//		public float hitChangeScalerFromTriggeredSkill;
//		public float manaChangeScalerFromTriggeredSkill;
//		public float attackChangeScalerFromTriggeredSkill;
//		public float attackSpeedChangeScalerFromTriggeredSkill;
//		public float armorChangeScalerFromTriggeredSkill;
//		public float magicResistChangeScalerFromTriggeredSkill;
//		public float dodgeChangeScalerFromTriggeredSkill;
//		public float critChangeScalerFromTriggeredSkill;
//		public float physicalHurtScalerChangeFromTriggeredSkill;
//		public float magicalHurtScalerChangeFromTriggeredSkill;
//		public float critHurtScalerChangeFromTriggeredSkill;

		/// <summary>
		/// 如果是即时性的属性变化,需要使用这个方法
		/// </summary>
		/// <param name="target">Target.</param>
		/// <param name="propertyType">Property type.</param>
		/// <param name="change">Change.</param>
		public void InstantPropertyChange(BattleAgentController target,PropertyType propertyType,float change,bool fromTriggeredSkill = true){

//			string instantChange = string.Format ("即时性属性变化: 角色名称:{0},类型:{1},变化:{2}",
//				target.agent.agentName, propertyType,change);
//
//			Debug.Log (instantChange);

			if (change == 0) {
				return;
			}

			int healthChange = 0;
			string tintText = "";

			if (propertyType == PropertyType.Health) {
				if (change > 0 && change < 1) {
					healthChange = (int)(target.agent.maxHealth * change);
					tintText = string.Format ("<color=green>{0}</color>", healthChange.ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.Gain);
				} else if (change >= 1) {
					healthChange = (int)change;
					tintText = string.Format ("<color=green>{0}</color>", healthChange.ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.Gain);
				} else if (change < 0 && change > -1) {
					healthChange = (int)(target.agent.maxHealth * change);
					tintText = string.Format ("<color=red>{0}</color>", (-healthChange).ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.None);
				} else {
					healthChange = (int)change;
					tintText = string.Format ("<color=red>{0}</color>", (-healthChange).ToString ());
					target.AddFightTextToQueue (tintText, SpecialAttackResult.None);
				}

				target.agent.health += healthChange;
				target.propertyCalculator.health = target.agent.health;

				if (target.agent.health <= 0) {
					target.AgentDie ();
				}

			} else {

				AgentPropertyChange (propertyType, change, fromTriggeredSkill);
		
				target.agent.ResetPropertiesWithPropertyCalculator (this);

			}
	
			target.UpdateStatusPlane ();
		}