void Awake()
    {
        transform.Find("ScreenHUD/Fader").gameObject.SetActive(true);
        style           = new GUIStyle();
        style.alignment = TextAnchor.MiddleCenter;
        style.fontSize  = 36;
        style.wordWrap  = true;
        textColor       = Color.white;
        textColor.a     = 0;
        textArea        = new Rect((Screen.width - w) / 2, 0, w, h);

        ThirdPersonOrbitCam cam = Camera.main.GetComponent <ThirdPersonOrbitCam>();
        float speed             = PlayerPrefs.GetFloat("aimingSpeed", cam.horizontalAimingSpeed * 10f);

        if (cam.horizontalAimingSpeed != speed / 10f)
        {
            cam.horizontalAimingSpeed = cam.verticalAimingSpeed = speed / 10f;
        }

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
        Cursor.SetCursor(cursorTexture, Vector2.zero, CursorMode.Auto);

        mainMenuUI          = transform.Find("ScreenHUD/MainMenuUI").gameObject;
        infoUI              = transform.Find("ScreenHUD/AboutUI").gameObject;
        settingsUI          = transform.Find("ScreenHUD/SettingsUI").gameObject;
        keyboardUI          = transform.Find("ScreenHUD/KeyboardUI").gameObject;
        gamepadUI           = transform.Find("ScreenHUD/GamepadUI").gameObject;
        adjustSensitivityUI = transform.Find("ScreenHUD/SensitivityUI").gameObject;
    }
 // Use this for initialization
 protected override void Start()
 {
     isOn         = false;
     playerHeight = 1.6f;
     tpoc         = CameraController.CC.CombatCamera.GetComponent <ThirdPersonOrbitCam> ();
     base.Start();
 }
Exemple #3
0
    void Update()
    {
        animator.speed = animationSpeed;
        if (rpgCharacterState == RPGCharacterState.CINEMATIC)
        {
            return;
        }
        //input abstraction for easier asset updates using outside control schemes
        bool inputUnarmed = Input.GetButtonDown("Unarmed");
        bool inputAiming  = Input.GetButtonDown("Aiming");
        //Camera relative movement
        Transform cameraTransform = sceneCamera.transform;

        camScript = cameraTransform.GetComponent <ThirdPersonOrbitCam>();
        //Forward vector relative to the camera along the x-z plane
        Vector3 forward = cameraTransform.TransformDirection(Vector3.forward);

        forward.y = 0;
        forward   = forward.normalized;
        //Right vector relative to the camera always orthogonal to the forward vector
        Vector3 right = new Vector3(forward.z, 0, -forward.x);

        //directional inputs
        if (ControllerInput.manager.dash)
        {
            dh = ControllerInput.manager.horizontal;
            dv = ControllerInput.manager.vertical;
        }
        if (!isRolling && !isAiming)
        {
            if (dv == 0 && dh == 0)
            {
                targetDashDirection = 0.5f * -transform.forward;
            }
            else
            {
                targetDashDirection = dh * right + dv * forward;
            }
        }
        //make sure there is animator on character
        if (animator)
        {
            if (!(canMove && !isBlocking && !isDead))
            {
                inputVec = new Vector3(0, 0, 0);
            }
            if (inputUnarmed && canAction && isGrounded && !isBlocking && weapon != Item.UNARMED)
            {
                StartCoroutine(_SwitchWeapon(0));
            }
        }
        else
        {
            Debug.Log("ERROR: There is no animator for character.");
        }
    }
Exemple #4
0
 void Awake()
 {
     // Set up the references.
     behaviours = new List <GenericBehaviour> ();
     anim       = GetComponent <Animator> ();
     hFloat     = Animator.StringToHash("H");
     vFloat     = Animator.StringToHash("V");
     camScript  = playerCamera.GetComponent <ThirdPersonOrbitCam> ();
     rbody      = GetComponent <Rigidbody> ();
 }
Exemple #5
0
    public void Start()
    {
        cam    = Camera.main.GetComponent <ThirdPersonOrbitCam>();
        slider = GetComponent <Slider>();
        float speed = cam.horizontalAimingSpeed * 10f;

        transform.Find("value").GetComponent <Text>().text = speed.ToString();
        slider.value = speed;
        //Adds a listener to the main slider and invokes a method when the value changes.
        slider.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
    }
Exemple #6
0
        public void StartGabrielCinematic()
        {
            portal.SetActive(false);
            RPGCharacterController.instance.SetModeCinematic();
            Gabriel.instance.GetComponent <BehaviorTree>().enabled = false;
            ThirdPersonOrbitCam camComponent = cam.GetComponent <ThirdPersonOrbitCam>();

            camComponent.currentBoss = Gabriel.instance.transform;
            camComponent.SetModeBoss();
            HudManager.manager.ChangeHUDVisibility();
        }
    void Awake()
    {
        for (var i = 0; i < Input.touchCount; ++i)
        {
            if (Input.GetTouch(i).phase == TouchPhase.Began)
            {
                if (Input.GetTouch(i).tapCount == 2)
                {
                    Debug.Log("Double Tap");
                }
            }
        }

        //Find Canvas
        canvas = GameObject.Find("Canvas").gameObject;

        //Find the joystick objects
        GameObject tempJoystickOne  = canvas.gameObject.transform.GetChild(0).gameObject;
        GameObject tempJoystickOTwo = canvas.gameObject.transform.GetChild(1).gameObject;


        //Assign Joysticks to script variables [Left,Right]
        if (tempJoystickOne)
        {
            joystickOne = tempJoystickOne.GetComponent <FixedJoystick>();
        }
        else
        {
            Debug.Log("No Left JoyStick");
        }

        if (tempJoystickOTwo)
        {
            joystickTwo = tempJoystickOTwo.GetComponent <FixedJoystick>();
        }
        else
        {
            Debug.Log("No Right JoyStick");
        }

        // Set up the references.
        behaviours           = new List <GenericBehaviour> ();
        overridingBehaviours = new List <GenericBehaviour>();
        anim      = GetComponent <Animator> ();
        hFloat    = Animator.StringToHash("H");
        vFloat    = Animator.StringToHash("V");
        camScript = playerCamera.GetComponent <ThirdPersonOrbitCam> ();
        rBody     = GetComponent <Rigidbody> ();

        // Grounded verification variables.
        groundedBool = Animator.StringToHash("Grounded");
        colExtents   = GetComponent <Collider>().bounds.extents;
    }
    protected float distToGround;                      // Actual distance to ground.

    void Awake()
    {
        // Set up the references.
        anim             = GetComponent <Animator> ();
        rbody            = GetComponent <Rigidbody> ();
        behaviourManager = GetComponent <BasicBehaviour> ();
        camScript        = behaviourManager.playerCamera.GetComponent <ThirdPersonOrbitCam> ();
        speedFloat       = Animator.StringToHash("Speed");
        canSprint        = true;

        // Set the behaviour code based on the inheriting class.
        behaviourCode = this.GetType().GetHashCode();
        distToGround  = GetComponent <Collider>().bounds.extents.y;
    }
Exemple #9
0
    private void Awake()
    {
        behaviours         = new List <GenericBehaviour>();
        overrideBehaviours = new List <GenericBehaviour>();
        playerTrans        = transform;
        playerAnimator     = GetComponent <Animator>();
        hFloat             = Animator.StringToHash(AnimatorKey.Horizontal);
        vFloat             = Animator.StringToHash(AnimatorKey.Vertical);
        camScript          = playerCamTrans.GetComponent <ThirdPersonOrbitCam>();
        playerRigidbody    = GetComponent <Rigidbody>();

        groundedBool = Animator.StringToHash(AnimatorKey.Grounded);
        colExtents   = GetComponent <Collider>().bounds.extents;
    }
Exemple #10
0
    void Awake()
    {
        // Set up the references.
        behaviours           = new List <GenericBehaviour>();
        overridingBehaviours = new List <GenericBehaviour>();
        anim      = GetComponent <Animator>();
        hFloat    = Animator.StringToHash("H");
        vFloat    = Animator.StringToHash("V");
        camScript = playerCamera.GetComponent <ThirdPersonOrbitCam>();
        rBody     = GetComponent <Rigidbody>();

        // Grounded verification variables.
        groundedBool = Animator.StringToHash("Grounded");
        colExtents   = GetComponent <Collider>().bounds.extents;
    }
Exemple #11
0
 void Awake()
 {
     mainCamera = GameObject.FindWithTag("MainCamera").GetComponent <ThirdPersonOrbitCam>();
 }
Exemple #12
0
    // Update is called once per frame
    void Update()
    {
        // Morir o regenerar vida
        if (vida < vida_max && vida > 0)
        {
            tiempo_reg -= Time.deltaTime;               // Comienza a regenerar vida despues del tiempo asignado
            if (tiempo_reg <= 0.0f)
            {
                vida += vel_cura * Time.deltaTime;
            }
        }
        // Cambiar arma
        if (!anim.GetCurrentAnimatorStateInfo(0).IsTag("Interrupt"))           // Solo puede cambiar arma si no está atacando
        {
            if (Input.GetButtonDown("Cambiar espada") && arma != 1)
            {
                anim.SetTrigger("Cambio arma");
                arma = 1;
                anim.SetBool("Una mano", true);
                sonido(4);
            }
            else if (Input.GetButtonDown("Cambiar lanza") && arma != 2)
            {
                anim.SetTrigger("Cambio arma");
                arma = 2;
                anim.SetBool("Una mano", false);
                sonido(4);
            }
            else if (Input.GetButtonDown("Cambiar martillo") && arma != 3)
            {
                anim.SetTrigger("Cambio arma");
                arma = 3;
                anim.SetBool("Una mano", false);
                sonido(4);
            }
        }

        // Defensa
        if (Input.GetButtonDown("Defensa"))
        {
            if (ThirdPersonCharacter.m_IsGrounded && !ThirdPersonCharacter.m_Crouching)
            {
                anim.SetBool("Defendiendo", true);
            }
        }

        if (Input.GetButtonUp("Defensa"))
        {
            anim.SetBool("Defendiendo", false);
        }

        // Si lo dañan mientras ataca, el ataque es false
        if (anim.GetCurrentAnimatorStateInfo(0).IsTag("Reaccion"))
        {
            ataque = false;
        }

        // Cambio de la distancia de la camara
        if (Input.GetButtonDown("Cambio camara"))
        {
            Vector3 cam;
            float   min_inf;
            if (camara)
            {
                min_inf = 0f;
                cam     = new Vector3(0.0f, 0.6f, -15.0f);             //valor para cambiar la distancia del personaje
                ThirdPersonOrbitCam.Cambiar_camara_offset(cam, min_inf);
                camara = false;
            }
            else
            {
                min_inf = 30f;
                cam     = new Vector3(0.1f, 0.6f, -2.8f);             // falta cambiar con el mouseroll
                ThirdPersonOrbitCam.Cambiar_camara_offset(cam, min_inf);
                camara = true;
            }
        }
        if (!anim.GetCurrentAnimatorStateInfo(0).IsTag("Interrupt") && doble_click <= 0.0f)             // Evita un ataque doble
        // Comandos tropas
        {
            if (Input.GetButtonDown("Detener tropas") || Input.GetButtonDown("Acercar tropas"))
            {
                doble_click = 0.4f;
                anim.SetTrigger("Llamado");
                sonido(5);
            }

            // Ataque
            if (Input.GetButtonDown("Ataque"))
            {
                doble_click = 0.4f;
                if (!ataque && vida > 0)
                {
                    atacar();
                }
            }
        }
        doble_click -= Time.deltaTime;

        //print (vida);
    }
Exemple #13
0
    public void InitializeCamera()
    {
        ThirdPersonOrbitCam tpoc = CameraController.CC.CombatCamera.GetComponent <ThirdPersonOrbitCam> ();

        tpoc.Initialize(GameController.GC.CurrentPlayerCharacter);
    }