Esempio n. 1
0
 // Update is called once per frame
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.GetComponent <Character> ())
     {
         Character_health character = col.gameObject.GetComponent <Character_health> ();
         character.hit(damage);
     }
 }
Esempio n. 2
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.GetComponent <Character> ())
     {
         Character_health character_health = col.gameObject.GetComponent <Character_health> ();
         character_health.health += 10;
         Destroy(gameObject);
     }
 }
Esempio n. 3
0
 void OnCollisionEnter(Collision col)
 {
     if (col.gameObject.GetComponent <Character> ())
     {
         Character_health character_health = col.gameObject.GetComponent <Character_health> ();
         Character        character        = col.gameObject.GetComponent <Character> ();
         character_health.hit(damage);
         character.hit_recover(transform.position);
     }
 }
Esempio n. 4
0
 void OnParticleCollision(GameObject GO)
 {
     if (GO.GetComponent <Character> ())
     {
         Character_health character_health = GO.GetComponent <Character_health> ();
         Character        character        = GO.GetComponent <Character> ();
         character_health.hit(damage);
         character.hit_recover(transform.position);
     }
 }
Esempio n. 5
0
 void OnTriggerEnter(Collider col)
 {
     if (col.GetComponent <Character>())
     {
         Character_health character = col.gameObject.GetComponent <Character_health> ();
         character.hit(50);
         if (col.gameObject.name == "FireCharacter")
         {
             col.gameObject.transform.position = GameMaster.fire_fall_pos;
         }
         else if (col.gameObject.name == "IceCharacter")
         {
             col.gameObject.transform.position = GameMaster.ice_fall_pos;
         }
     }
 }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        if (InputManager.Devices.Count == 1)
        {
            control1 = InputManager.Devices[0];
        }
        else if (InputManager.Devices.Count == 2)
        {
            control1 = InputManager.Devices[0];
            control2 = InputManager.Devices[1];
        }
        pause();
        if (GameObject.Find("FireCharacter") && GameObject.Find("IceCharacter"))
        {
            Character_health fire = GameObject.Find("FireCharacter").GetComponent <Character_health>();
            Character_health ice  = GameObject.Find("IceCharacter").GetComponent <Character_health>();
            if (HP_fire_num)
            {
                fireLife = fire.get_health();
                iceLife  = ice.get_health();
                float ratio1 = (float)fireLife / (float)100;
                float ratio2 = (float)iceLife / (float)100;
                HP_fire_num.guiText.text      = (ratio1 * 100).ToString() + "/100";
                HP_ice_num.guiText.text       = (ratio2 * 100).ToString() + "/100";
                HP_fire.guiTexture.pixelInset = new Rect(10, Screen.height * 0.9f, ratio1 * 300, 30);
                HP_ice.guiTexture.pixelInset  = new Rect(Screen.width - 310, Screen.height * 0.9f, ratio2 * 300, 30);
            }
        }

        if (Input.GetKeyDown("1"))
        {
            position = 1;
            put_character();
        }

        if (Input.GetKeyDown("2"))
        {
            position = 2;
            put_character();
        }

        if (Input.GetKeyDown("3"))
        {
            position = 3;
            put_character();
        }
    }