コード例 #1
0
    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);
        }
    }
コード例 #2
0
 // 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;
     }
 }
コード例 #3
0
 void Update()
 {
     transform.Translate(0, -speed * Time.deltaTime, 0);
     if (transform.position.y <= -0.8f)
     {
         Destroy(gameObject);
         ninjaManager.takeDamage(groundDamage); // health - 1;
     }
 }
コード例 #4
0
 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;
     }
 }