private void OnTriggerEnter2D(Collider2D collision) { if (collision.transform.GetComponentInParent <PlayerStateMachine>()) { if (collision.GetComponent <ProjectileScript>()) { } else if (owner.GetComponent <PlayerStateMachine>()) { } else { PlayerStateMachine psm = collision.transform.GetComponentInParent <PlayerStateMachine>(); psm.lastDamageAmt = damage; psm.SetState(new TakeDamage(psm)); Destroy(gameObject); } } else if (collision.transform.GetComponentInParent <ZombieStateMachine>()) { if (owner.GetComponent <CultistStateMachine>()) { } else { ZombieStateMachine zsm = collision.transform.GetComponentInParent <ZombieStateMachine>(); zsm.lastDamageAmt = damage; zsm.SetState(new TakeDamage(zsm)); GameObject aud = Instantiate(audio_player, transform.position, Quaternion.identity); aud.GetComponent <AudioSource>().volume = .5f; aud.GetComponent <AudioSource>().PlayOneShot(impact_flesh); Destroy(gameObject); } } else if (collision.transform.GetComponentInParent <BlemmeyStateMachine>()) { if (owner.GetComponent <CultistStateMachine>()) { } else { BlemmeyStateMachine bsm = collision.transform.GetComponentInParent <BlemmeyStateMachine>(); bsm.lastDamageAmt = damage; bsm.SetState(new TakeDamage(bsm)); GameObject aud = Instantiate(audio_player, transform.position, Quaternion.identity); aud.GetComponent <AudioSource>().volume = .5f; aud.GetComponent <AudioSource>().PlayOneShot(impact_flesh); Destroy(gameObject); } } else if (collision.transform.GetComponentInParent <CultistStateMachine>()) { if (owner.GetComponent <CultistStateMachine>()) { } else { CultistStateMachine csm = collision.transform.GetComponentInParent <CultistStateMachine>(); csm.lastDamageAmt = damage; csm.SetState(new TakeDamage(csm)); GameObject aud = Instantiate(audio_player, transform.position, Quaternion.identity); aud.GetComponent <AudioSource>().volume = .5f; aud.GetComponent <AudioSource>().PlayOneShot(impact_flesh); Destroy(gameObject); } } else if (collision.transform.GetComponentInParent <PrideStateMachine>()) { if (owner.GetComponent <PrideStateMachine>()) { } else { PrideStateMachine psm = collision.transform.GetComponentInParent <PrideStateMachine>(); psm.lastDamageAmt = damage; psm.SetState(new TakeDamage(psm)); GameObject aud = Instantiate(audio_player, transform.position, Quaternion.identity); aud.GetComponent <AudioSource>().volume = .5f; aud.GetComponent <AudioSource>().PlayOneShot(impact_flesh); Destroy(gameObject); } } else if (collision.tag == "colliders" || collision.tag == "lava") { } else { GameObject aud = Instantiate(audio_player, transform.position, Quaternion.identity); aud.GetComponent <AudioSource>().volume = .5f; aud.GetComponent <AudioSource>().PlayOneShot(impact); Destroy(gameObject); } }
public Pride_Slam(PrideStateMachine sm) : base(sm) { }
public Attack(PrideStateMachine sm) : base(sm) { isPride = true; }
public Pride_Charge(PrideStateMachine sm) : base(sm) { }
public TakeDamage(PrideStateMachine sm) : base(sm) { isPride = true; prStateMachine.health -= prStateMachine.lastDamageAmt; }
public State(PrideStateMachine sm) { this.prStateMachine = sm; }