public override void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player" && m_team != collision.gameObject.GetComponent <PlayerStats>().teamId) { DoDamage(collision.gameObject, collision.contacts[0].point, 0f); IgnoreCollision(collision.collider, true); GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject go in players) { PlayerStats ps = go.GetComponent <PlayerStats>(); if (ps.teamId == this.m_team && ps.id != this.m_owner && Vector3.Distance(m_handler.transform.position, go.transform.position) < m_healDistance) { BuffLightSkill2 buff = ps.GetComponent <BuffLightSkill2>(); if (buff != null) { ps.doHeal((int)(GetDamage() * buff.GetAmount() * m_porcenHeal / 100.0f)); } else { ps.doHeal((int)(GetDamage() * m_porcenHeal / 100.0f)); } } } } }
public void OnTriggerEnter(Collider other) { if (other.tag == "Player" && other.GetComponent <PlayerStats>().teamId != m_team) { players.Add(other.GetComponent <PlayerStats>()); Globals.WriteLog("BuffLightSkill2: Meto a " + other.GetComponent <PlayerStats>().id); } else if (other.tag == "Player" && other.GetComponent <PlayerStats>().teamId == m_team) { Globals.WriteLog("Me meto a mi mismo"); BuffLightSkill2 bs = other.GetComponent <PlayerStats>().gameObject.AddComponent <BuffLightSkill2>(); bs.Init(m_lightMultiplier, m_duration, m_skillId, m_handler.m_PlayerStats); } }