internal static StateBuff_State CaclStateFromStr(string str) { StateBuff_State result = StateBuff_State.Default; if (str.Equals("Skill")) { result = StateBuff_State.Skill; } return(result); }
private void OnCollision(uint targetEntityId) { GameEntity target = m_Instance.Target as GameEntity; GameEntity collideTarget = Contexts.sharedInstance.game.GetEntityWithId(targetEntityId); if (null == target || null == collideTarget) { return; } if (!target.hasCamp || !collideTarget.hasCamp || target.camp.Value == collideTarget.camp.Value) { return; } float time = Contexts.sharedInstance.input.time.Value; long lastHitTime = -1; if (m_Interval > 0 && m_DamagedEntities.TryGetValue(targetEntityId, out lastHitTime)) { if (time * 1000 < lastHitTime + m_Interval) { LogUtil.Info("ColliderDamage.OnCollision drop collide event due to interval."); return; } } if (null != target && null != collideTarget && !collideTarget.hasDead) { StateBuff_State state = GetState(collideTarget); StateBuff stateBuff; if (!m_StateImpacts.TryGetValue(state, out stateBuff)) { m_StateImpacts.TryGetValue(StateBuff_State.Default, out stateBuff); } if (null != stateBuff) { foreach (int buffId in stateBuff.m_Buffs) { UnityClient.BuffSystem.Instance.StartBuff(target, collideTarget, buffId, target.position.Value, target.rotation.Value); } } m_DamagedEntities[targetEntityId] = (long)(time * 1000); m_Instance.SendMessage("oncollision"); } }
protected override ExecResult ExecCommand(IInstance instance, long delta) { if (instance.Target is GameEntity obj) { Quaternion quaternion = Quaternion.Euler(0, Mathf.Rad2Deg * obj.rotation.Value, 0); Vector3 center = obj.position.Value + quaternion * m_RelativeCenter; UnityClient.GfxSystem.DrawCircle(center, m_Range, 2.0f); var entities = Contexts.sharedInstance.game.GetGroup(GameMatcher.Position); foreach (var entity in entities) { if (entity == obj) { continue; } if (entity.hasCamp && obj.hasCamp && entity.camp.Value == obj.camp.Value) { continue; } if (InCircle(center, m_Range, entity.position)) { if (!entity.hasDead) { StateBuff_State state = GetState(entity); if (!m_StateImpacts.TryGetValue(state, out StateBuff stateBuff)) { m_StateImpacts.TryGetValue(StateBuff_State.Default, out stateBuff); } if (null != stateBuff) { foreach (int buffId in stateBuff.m_Buffs) { UnityClient.BuffSystem.Instance.StartBuff(obj, entity, buffId, obj.position.Value, obj.rotation.Value); } } } } } } return(ExecResult.Finished); }