Example #1
0
    private void Update()
    {
        panLeft  = Input.GetKey("q");
        panRight = Input.GetKey("e");
        if (Input.GetKeyDown("p"))
        {
            pan_type = pan_type == Constants.PanType.MOUSE ? Constants.PanType.KEY : Constants.PanType.MOUSE;
        }
        leftMove    = Input.GetKey("a");
        rightMove   = Input.GetKey("d");
        forwardMove = Input.GetKey("w");
        backMove    = Input.GetKey("s");
        jump        = Input.GetKeyDown(KeyCode.Space);
        for (int i = 0; i < 10; i++)
        {
            abs[i] = Input.GetKey(ALPHAS[i]) && spellCoolDownTimers[i] <= 0;
        }
        //ab1 = Input.GetKeyDown(KeyCode.Alpha1);
        //ab2 = Input.GetKey(KeyCode.Alpha2) || hsm.fireballDown;
        //ab3 = Input.GetKeyDown(KeyCode.Alpha3);
        //ab4 = Input.GetKeyDown(KeyCode.Alpha4);
        //ab5 = Input.GetKeyDown(KeyCode.Alpha5);

        if (pan_type == Constants.PanType.MOUSE)
        {
            //if(Input.mousePosition.x > 0 && Input.mousePosition.x < Screen.width)
            xangle += camSpeed * Input.GetAxis("Mouse X");
            //if(Input.mousePosition.y > 0 && Input.mousePosition.y < Screen.height)
            //yangle -= camSpeed * Input.GetAxis("Mouse Y") * 550/Screen.height;
            yangle = (Mathf.Max(Mathf.Min(Input.mousePosition.y, Screen.height), 0) / Screen.height - .5f) * -120;
        }
        xangle += camSpeed * ((panRight ? 1 : 0) + (panLeft ? -1 : 0));
        cameraTransform.eulerAngles = new Vector3(yangle, xangle, 0);
        transform.eulerAngles       = new Vector3(0, xangle, 0);


        if (Input.GetKey("z"))
        {
            fp.positionBack -= 10 * Time.deltaTime;
        }
        if (Input.GetKey("x"))
        {
            fp.positionBack += 10 * Time.deltaTime;
        }
    }
Example #2
0
    void Start()
    {
        playerRB = this.GetComponent <Rigidbody>();
        pan_type = Constants.PanType.MOUSE;
        playerRB.AddForce(0, 200, 0);
        abilities = this.gameObject.GetComponent <Abilities>();
        num_jumps = max_jumps;
        hsm       = GameObject.Find("GameManager").GetComponent <hellSceneManager>();
        fp        = cam.GetComponent <FollowPlayer>();

        spellCoolDownTimeOut = new float[10] {
            0, .5f, 0, .2f, 1f, 4f, 0, 0, 0, 0
        };
        GameObject tempObj = new GameObject();

        tempObj.transform.position    = transform.position;
        tempObj.transform.eulerAngles = transform.eulerAngles;
        cameraTransform = tempObj.transform;
        wallInPlay      = false;
    }