override protected void OnTriggerEnter(Collider collision) { impulseDir = Vector3.Normalize(this.transform.position - collision.transform.position); //Debug.Log(impulseDir); impulseDir = new Vector3(impulseDir.x, 0, impulseDir.z); if (isFalling) { IPlayer player = collision.gameObject.GetComponent <IPlayer>(); if (player != null) { DoDamage(player); } } AbstractAbilities habilitie = collision.gameObject.GetComponent <AbstractAbilities>(); if (habilitie != null) { Debug.Log("Lo toco una habilidad"); if (InteractWith(habilitie)) { return; } } if (!isDevided) { OnImpact(); } base.OnTriggerEnter(collision); }
override protected void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer == 10) { isFalling = false; } impulseDir = Vector3.Normalize(this.transform.position - collision.transform.position); impulseDir = new Vector3(impulseDir.x, 0, impulseDir.z); if (isFalling) { IPlayer player = collision.gameObject.GetComponent <IPlayer>(); if (player != null) { DoDamage(player); } } AbstractAbilities habilitie = collision.gameObject.GetComponent <AbstractAbilities>(); if (habilitie != null) { Debug.Log("Lo toco una habilidad"); if (InteractWith(habilitie)) { return; } } if (collision.gameObject.layer == 13 || collision.gameObject.layer == 12) { Explode(); if (isFalling) { HealthSystem hasHealSystem = collision.gameObject.GetComponent <HealthSystem>(); if (hasHealSystem != null) { if (isHealHabilitie) { hasHealSystem.Sethealth(hasHealSystem.GetHealth() + powerValue); } else { hasHealSystem.Sethealth(hasHealSystem.GetHealth() - powerValue); } } } } //base.OnCollisionEnter(collision); if (!isDevided) { OnImpact(); } }
override protected void OnTriggerEnter(Collider other) { AbstractAbilities habilitie = other.gameObject.GetComponent <AbstractAbilities>(); if (habilitie != null) { Debug.Log("Lo toco una habilidad"); if (InteractWith(habilitie)) { return; } } }
protected override void OnTriggerEnter(Collider other) { Debug.Log("Mirror Detect Trigger"); AbstractAbilities habilitie = other.gameObject.GetComponent <AbstractAbilities>(); if (habilitie != null) { lastHabilitieContact = habilitie; if (InteractWith(habilitie)) { return; } } base.OnTriggerEnter(other); }
protected bool InteractWith(AbstractAbilities h) { foreach (Powers.Power power in h.GetPowers()) { foreach (Powers.Power myPowerInteraction in powersInteractions.Keys) { if (myPowerInteraction.Equals(power)) { powersInteractions[myPowerInteraction](); return(true); } } } return(false); }
override protected void OnTriggerEnter(Collider other) { Debug.Log("Absorption Ball Detect Trigger"); AbstractAbilities habilitie = other.gameObject.GetComponent <AbstractAbilities>(); if (habilitie != null) { lastHabilitieContact = habilitie; if (lastHabilitieContact.IsHealHabilitie()) { this.isHealHabilitie = true; } if (InteractWith(habilitie)) { return; } } base.OnTriggerEnter(other); }
/* * public void OnCollisionEnter(Collision collision) * { * AbstractHabilities habilitie = collision.gameObject.GetComponent<AbstractHabilities>(); * if (habilitie != null) * { * if (InteractWith(habilitie)) * return; * } * } */ override protected void OnTriggerEnter(Collider other) { Player collideWithPlayer = other.gameObject.GetComponent <Player>(); if (collideWithPlayer != null) { } else { AbstractAbilities habilitie = other.gameObject.GetComponent <AbstractAbilities>(); if (habilitie != null) { if (InteractWith(habilitie)) { return; } } CreateExplodeParticles(); } base.OnTriggerEnter(other); }
private void ChangeMaterialToAbsorbedSpell(AbstractAbilities abilitie) { GetComponent <Renderer>().material = abilitie.GetComponent <Renderer>().material; }