void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { heal = other.GetComponent <hp>(); heal.AdjustCurrentHealth(dmg); } }
/* void OnTriggerEnter2D(Collider2D plyr) * { * if (plyr.gameObject.tag == "Player") * { * // play=F.gameObject.GetComponent<hp>(); * //Find * play.AdjustCurrentHealth(-10); * Debug.Log("called it"); * } * }*/ public override void Act(Transform player, Transform npc) { destPos = player.position; if (Vector3.Distance(npc.position, destPos) <= 0.50f) {//Do the attacking thing here. if (!attacking && timer <= 0) { play.AdjustCurrentHealth(-10); //curSpeed = 1.0f; if (player.position.x > npc.position.x)//JUMP BACK. DAMAGEY STUFF HERE { player.GetComponent <Rigidbody2D>().AddForce(new Vector2(4500, 400), ForceMode2D.Force); player.GetComponent <ParticleSystem>().Play(); } else { player.GetComponent <Rigidbody2D>().AddForce(new Vector2(-4500, 400), ForceMode2D.Force); } attacking = true; timer = 2; Debug.Log("Enemy Should Attack"); } } if (Vector3.Distance(npc.position, destPos) >= .51f) { if (attacking) { Debug.Log("enemy reset"); // curSpeed = 0.25f; attacking = false; } timer -= Time.deltaTime; if (timer <= 0) { player.GetComponent <ParticleSystem>().Stop(); } } if (runonce) { runonce = false; } //Rotate to the target point (instantly) npc.transform.LookAt(destPos); /*Quaternion targetRotation = Quaternion.LookAt(destPos - npc.position); * /*npc.rotation = Quaternion.Slerp(npc.rotation, targetRotation, Time.deltaTime * curRotSpeed); code that could be used to make the character rotate instead of snap, was buggy so commented out.*/ //Go Forward npc.Translate(Vector3.forward * Time.deltaTime * curSpeed); }
public void SealOfSolomon() { if (Sea == 0) { cost = -500; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Sea = 1; }
public void Zypher() { if (Zyp == 0) { cost = -500; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Zyp = 1; }
public void Reservoir() { if (Res == 0) { cost = -1500; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Res = 1; }
public void Container() { if (Con == 0) { cost = -500; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Con = 1; }
public void LapusLazuli() { if (Lep == 0) { cost = -150; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Lep = 1; }
//Purchase Functions public void Ifrit() { if (Ifr == 0) { cost = -200; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); Setp.text = "Purchased"; Ifr = 1; } }
public void Lust() { if (Lus == 0) { cost = -500; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Lus = 1; }
public void Gluttony() { if (Glu == 0) { cost = -500; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Glu = 1; }
public void Pride() { if (Pri == 0) { cost = -500; heal = PL.GetComponent <hp>(); heal.AdjustCurrentHealth(cost); } Setp.text = "Purchased"; Pri = 1; }