private void OnTriggerEnter(Collider other) // if its hit increase score and destroy { if (other.gameObject == GameObject.Find("Sword_Mesh")) { hits++; if (hits == 10) { Destroy(gameObject); ninjaManager.keepScore(points); //score + 1; } //Debug.Log( "KATANA HIT" ); } if (other.gameObject == GameObject.Find("customSyurikenn(Clone)")) { hits++; if (hits == 10) { Destroy(gameObject); ninjaManager.keepScore(points); //score + 1; } //Debug.Log( "KATANA HIT" ); } if (other.gameObject == FPC) { Destroy(gameObject); ninjaManager.takeDamage(50); } }
// Update is called once per frame void Update() { transform.Translate(0, -speed * Time.deltaTime, 0); if (transform.position.y <= -0.6f) // if it hits the ground destroy and decrease score { Destroy(gameObject); ninjaManager.takeDamage(groundDamage); // health - 1; } }
void Update() { transform.Translate(0, -speed * Time.deltaTime, 0); if (transform.position.y <= -0.8f) { Destroy(gameObject); ninjaManager.takeDamage(groundDamage); // health - 1; } }
void Update() { transform.Rotate(-rotSpeed * Time.deltaTime, 0, Time.deltaTime); transform.Translate(0, -speed * 2.0f * Time.deltaTime, 0); if (transform.position.y <= -0.6f) // if it hits the ground, destroy { Destroy(gameObject); ninjaManager.takeDamage(groundDamage); // health - 1; } }