Example #1
0
 // Use this for initialization
 void Start()
 {
     // la cam1 es la que va a estar habilitada
     cam1.GetComponent <Camera> ().enable = true;
     // la cam2 va a estar deshabilitada
     cam2.GetComponent <Camera> ().enable = false;
 }
Example #2
0
    void OnTriggerStay2D(Collider2D col)
    {
        if (col.gameObject.GetComponent <player>())
        {
            Debug.Log("hi");
            var oldpos = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.y);

            var newpos = new Vector3(this.transform.position.x, yhight, this.transform.position.z);
            camara.transform.position = Vector3.Lerp(this.transform.position, newpos, 10);
            //if(player.transform.position.y != newpos.y)
            //{
            //    camara.transform.position = Vector3.Lerp(this.transform.position, oldpos, 0.05f);
            //}
            if (locks)
            {
                camara.GetComponent <camera>().lockcamera   = true;
                camara.GetComponent <camera>().playerfollow = false;
            }
            if (locks == false)
            {
                camara.GetComponent <camera>().lockcamera   = false;
                camara.GetComponent <camera>().playerfollow = true;
            }
        }
    }
Example #3
0
 void Start()
 {
     //anim = GetComponent<Animator>();
     cont = GetComponent <CharacterController>();
     on   = false;
     //anim.SetBool("on", on);
     jumpon     = false;
     accorot    = 0;
     cameraanim = cam.GetComponent <Animator>();
     health     = 100;
 }