Example #1
0
 void Start()
 {
     camP       = FindObjectOfType <CameraPlayer>();
     mPlayer    = FindObjectOfType <MovimientosPlayer>();
     meshNave   = GetComponentsInChildren <SkinnedMeshRenderer>();
     myNaveAnim = GetComponent <Animator>();
 }
Example #2
0
    public override void Setup(Camera CameraTemplate, PlayerController[] ToFollow, CanvasGroup UI, PlayerUIHandler PlayerUITemplate)
    {
        Destroy();
        base.Setup(CameraTemplate, ToFollow, UI, PlayerUITemplate);

        follow = new PlayerController[ToFollow.Length];
        for (int i = 0; i < ToFollow.Length; i++)
        {
            follow[i] = ToFollow[i];
        }

        cameras = new Camera[follow.Length];
        for (int i = 0; i < cameras.Length; i++)
        {
            cameras[i] = Instantiate(CameraTemplate);
            cameras[i].gameObject.SetActive(true);
            cameras[i].gameObject.name = string.Format("Camera{0}", i + 1);
            cameras[i].transform.SetParent(transform, false);

            Rect rect = cameras[i].rect;
            rect.x     = (i % 2) * 0.5f;
            rect.width = 0.5f;

            if (ToFollow.Length > 2)
            {
                rect.height = 0.5f;
                if ((i / 2) < 1)
                {
                    rect.y = 0.5f;
                }
            }

            cameras[i].rect = rect;

            CameraPlayer cp = cameras[i].GetComponent <CameraPlayer>();
            if (cp == null)
            {
                cp = cameras[i].gameObject.AddComponent <CameraPlayer>();
            }

            cp.Follow = follow[i];
        }

        orthographicSize = CameraTemplate.orthographicSize;
    }
    private void Awake()

    //Seguir probando con la colision rigid body,box collider casi funciona
    {
        InitialSpeed = runSpeed;
        camPlayer    = FindObjectOfType <CameraPlayer>();
        movNave      = FindObjectOfType <MovimientosNave>();
        boxC         = GetComponent <BoxCollider>();

        miAnimator = GetComponentInParent <Animator>();

        naveAnimator = movNave.GetComponent <Animator>();
        //----------------------------------------------------------
        psControl = new PS4Control();


        //Agacharse
        psControl.Movimientos.agachar.performed += ctx => agacho = true;
        psControl.Movimientos.agachar.canceled  += ctx => agacho = false;
        //SAlto
        psControl.Movimientos.saltar.performed += ctx => saltar = true;
        psControl.Movimientos.saltar.canceled  += ctx => saltar = false;
        //Giro
        psControl.Movimientos.Spin.started  += ctx => giro = true;
        psControl.Movimientos.Spin.canceled += ctx => giro = false;


        //Puñetazo
        psControl.Movimientos.puñetazo.started  += ctx => puñetazo = true;
        psControl.Movimientos.puñetazo.canceled += ctx => puñetazo = false;

        //Movimiento
        psControl.Movimientos.Caminar.performed += ctx => movimiento = ctx.ReadValue <Vector2>();
        psControl.Movimientos.Caminar.canceled  += ctx => movimiento = Vector2.zero;


        //Gestion de escena
        psControl.Movimientos.reiniciarApp.started += ctx => Application.LoadLevel(0);
        //psControl.Movimientos.reiniciarApp.canceled += ctx => ;

        psControl.Movimientos.salirApp.started += ctx => Application.Quit();
    }
Example #4
0
 private void Awake()
 {
     I = this;
 }
 // Use this for initialization
 void Start()
 {
     m_molat          = GetComponent <Molat>();
     myCamera         = GetComponentInChildren <CameraPlayer>();
     Cursor.lockState = CursorLockMode.Locked;
 }
 void Start()
 {
     mainCamera = Camera.main;
     cPlayer = mainCamera.GetComponent<CameraPlayer> ();
 }