Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (transform.childCount > 0)
     {
         if (!activated)
         {
             if (transform.GetChild(0).gameObject.tag == "Robot")
             {
                 GameObject robot = transform.GetChild(0).gameObject;
                 if (robot.transform.position.x == transform.position.x &&
                     robot.transform.position.z == transform.position.z)
                 {
                     RobotMovement robot_scr = robot.GetComponent <RobotMovement>();
                     AudioManager.instance.Play("tile_warp");
                     if (robot_scr.Respawn())
                     {
                         activated = true;
                     }
                 }
             }
         }
     }
     else
     {
         activated = false;
     }
 }
Esempio n. 2
0
    IEnumerator Explode()
    {
        hit = true;
        foreach (Renderer r in GetComponentsInChildren <Renderer>())
        {
            r.enabled = false;
        }
        audio_source.clip = explosion;
        audio_source.Play();
        RobotMovement robot_scr = target.GetComponent <RobotMovement>();

        robot_scr.Respawn();
        yield return(new WaitForSeconds(audio_source.clip.length));

        Destroy(this.gameObject);
    }