Example #1
0
		public int AddBuff(BuffParam param)
		{
			if (param.templateID <= 0)
				return (int)ActionReult.ParamError;

			Buff_Tbl buffTbl = ConfigPool.Instance.GetDataByKey<Buff_Tbl>(param.templateID);
			if (null == buffTbl)
				return (int)ActionReult.CfgError;

			// firstly cover same series
			foreach (var value in mBuffInstList.Values)
			{
				if (null == value)
					continue;

				Buff_Tbl buffTemp = value.Template;
				if (buffTemp.buffType == buffTbl.buffType)
				{
					if ((int)CoverType.Cover == buffTbl.coverType)
					{
						CoverBuff(value, param);
						return (int)ActionReult.Success;
					}
				}
			}

			return DoAddBuff(param);
		}
Example #2
0
		public override void OnActive(int ownerID, SkillParam skillParam)
		{
			if (skillParam.templateID <= 0)
				return;

			Skill_Tbl skillTbl = ConfigPool.Instance.GetDataByKey<Skill_Tbl>(skillParam.templateID);
			if (null == skillTbl)
			{
				Log.LogError("SkillLogicBuff.OnActive : invalid skill id.");
				return;
			}

			if (skillTbl.buff1[0] > 0)
			{
				BuffParam buffParam = new BuffParam();
				buffParam.templateID = skillTbl.buff1[0];
				buffParam.senderID = ownerID;
				buffParam.receiverID = skillParam.targetID;

				BuffManager.Instance.AddBuff(ownerID, buffParam);
			}
		}
Example #3
0
	private bool TestCollision()
	{
		RaycastHit hitInfo;
		int layerMask = 1 << LayerMask.NameToLayer(GameDefines.LayerTerrain)
			| 1 << LayerMask.NameToLayer(GameDefines.LayerNPC);
		if (Physics.Raycast(mTransform.position, mTransform.forward, out hitInfo, mSpeed * Time.deltaTime, layerMask))
		{
			if (hitInfo.collider.gameObject.layer == LayerMask.NameToLayer(GameDefines.LayerTerrain))
			{
				DispawnMe();
			}
			else if (hitInfo.collider.gameObject.layer == LayerMask.NameToLayer(GameDefines.LayerNPC))
			{
				//  add buff
				Agent agentHit = hitInfo.collider.gameObject.GetComponent<Agent>();
				if (null == agentHit)
				{
					Log.LogError("projectile arrow : TestCollision, agent is null.");
				}
				else
				{
					BuffParam param = new BuffParam();
					param.templateID = mProjectileTbl.buff1[0];
					param.senderID = mAgentOwner.blackboard.guid;
					param.receiverID = agentHit.blackboard.guid;
					BuffManager.Instance.AddBuff(agentHit.blackboard.guid, param);
				}
				// show hit effect
				// ...

				DispawnMe();
				
			}
		}

		return false;
	}
Example #4
0
		private int DoAddBuff(BuffParam param)
		{
			Buff buff = BuffPool.Instance.GetOne();
			if (buff != null)
			{
				buff.Init(++mIdCounter, param);

				buff.Active();

				return (int)ActionReult.Success;
			}

			return (int)ActionReult.Falied;
		}
Example #5
0
		private void CoverBuff(Buff oldBuff, BuffParam param)
		{
			RemoveBuff(oldBuff.ID);
			DoAddBuff(param);
		}