//Enter Water void OnTriggerEnter(Collider collision) { if (collision.GetComponent <DamageArea>())//When the Character's Damage Area Trigger Touches the Water Swim Trigger { if (collision.GetComponentInParent <AntAI>()) { AntScript = collision.GetComponentInParent <AntAI>(); AntScript.inWater = true; whichScript = 1; } else if (collision.GetComponentInParent <DemigodAI>()) { DemigodScript = collision.GetComponentInParent <DemigodAI>(); DemigodScript.inWater = true; whichScript = 2; } else if (collision.GetComponentInParent <MinotaurAI>()) { MinotaurScript = collision.GetComponentInParent <MinotaurAI>(); MinotaurScript.inWater = true; whichScript = 3; } else if (collision.GetComponentInParent <MedusaAI>()) { MedusaScript = collision.GetComponentInParent <MedusaAI>(); MedusaScript.inWater = true; whichScript = 4; } else if (collision.GetComponentInParent <PlayerHealth>())//1 { PlayerScript = collision.GetComponentInParent <PlayerHealth>(); PlayerSwim = collision.GetComponentInParent <Swimming>(); PlayerScript.inWater = true; PlayerSwim.inWater = true; whichScript = 5; } else if (collision.GetComponentInParent <ChimeraAI>()) { ChimeraScript = collision.GetComponentInParent <ChimeraAI>(); ChimeraScript.inWater = true; whichScript = 6; } if (whichScript == 5)//Why is this here??????????????????????? Why not just put these statements in the *1 above? Same below in Trigger Exit { PlayerSwim.whatToDo(true); underwaterAudio.Play(); } } }
void Start() { stoneRot.eulerAngles = new Vector3(0, 0, 0); MudusaScript = gameObject.GetComponent <MedusaAI>(); rangedATKTime = gameObject.GetComponent <NPCAI>().rangedATKTime; }