void OnTriggerEnter2D(Collider2D coll) { DamageableMono damageable = coll.gameObject.GetComponent <DamageableMono>(); if (damageable && damageable.damSO.faction != myFaction) { damageable.damSO.AddAmountToHealth(-1); } }
void OnCollisionEnter2D(Collision2D collider) { DamageableMono damageable = collider.gameObject.GetComponent <DamageableMono>(); if (damageable && damageable.damSO.faction != DamagerSO.faction) { LastHitDamageable = damageable; Attack(); } }
void OnTriggerExit2D(Collider2D collider) { DamageableMono damageable = collider.GetComponent <DamageableMono>(); if (damageable) { if (DamageablesInRange.Contains(damageable)) { DamageablesInRange.Remove(damageable); } } }
public void RegisterDamageable(DamageableMono damageable, FactionSO faction) { if (!Damageables.Contains(damageable)) { Damageables.Add(damageable); Factions.Add(faction); } else { Debug.LogError("damageable " + damageable.name + " already exists in set."); } }
void OnTriggerExit2D(Collider2D collider) { DamageableMono dam = collider.GetComponent <DamageableMono>(); if (dam) { if (TargetTrans == dam.transform) { TargetTrans = null; } } }
void OnTriggerEnter2D(Collider2D collider) { DamageableMono dam = collider.GetComponent <DamageableMono>(); if (dam) { if (dam.damSO.faction != bulletMono.damagerSO.faction) { TargetTrans = dam.transform; } } }
public void UnregisterDamageable(DamageableMono damageable, FactionSO faction) { if (Damageables.Contains(damageable)) { int i = Damageables.IndexOf(damageable); Damageables.Remove(damageable); Factions.RemoveAt(i); } else { Debug.LogError("damageable " + damageable.name + " does not exist in set."); } }
private void Awake() { if (SR == null) { Debug.Log("Yo where's my sprite renderer"); } DamageableMono = GetComponent <DamageableMono>(); FatCatAnimator = GetComponentInChildren <Animator>(); RangedWeaponMono.onShootEvent += OnShoot; DamageableMono.onDeathMonoEvent += OnSubdued; InitialScale = SR.transform.localScale; ExpandedScale = new Vector3(InitialScale.x * 1.3f, InitialScale.y * 1.3f, 1f); }
void OnCollisionEnter2D(Collision2D collision) { DamageableMono dam = collision.gameObject.GetComponent <DamageableMono>(); if (dam) { if (dam.damSO.faction != DamagerSO.faction) { dam.damSO.AddAmountToHealth(-DamagerSO.damage); Attack(); } } gameObject.SetActive(false); }
void OnTriggerEnter2D(Collider2D collider) { DamageableMono damageable = collider.GetComponent <DamageableMono>(); if (damageable != null) { if (damageable.damSO.faction != this.DamagerSO.faction) { if (!DamageablesInRange.Contains(damageable)) { DamageablesInRange.Add(damageable); } else { Debug.LogError("Attempted to add damageable " + damageable.gameObject.name + " to damageable list, but it already exists."); } } } }
void Start() { DamageableMono = GetComponent <DamageableMono>(); DamageableMono.onDamageMonoEvent += OnDamaged; DamageableMono.onDeathMonoEvent += OnDeath; }