Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class characterController : MonoBehaviour {
- /*/////////////////////////////////////////////////
- * DECLARATIONS
- *///////////////////////////////////////////////////
- //CAMERAS BEGIN
- //camera storage variables
- public Camera firstPersonCamera;
- public Camera thirdPersonCamera;
- private bool firstPerson = true;
- private bool thirdPerson = false;
- //camera_movement_speed
- public float speed = 5.0f;
- //CAMERAS END
- //ANIMATION/MOVEMENT BEGIN
- //animation controller
- public Animator animationController;
- //animation modes
- /*
- *0 = unalert
- *1 = combat stance
- *2 = sneaking stance
- *3 = wounded
- */
- public float animation_mode = 0;
- //animation states
- /*
- * 0 = still
- * 1 = moving slow/walking
- * 2 = moving fast/running/jogging
- */
- public float animation_state = 0;
- //swing_state
- /* THIS USES A COMPASS SYSTEM. Up is north, west is left, down is south, east is right.
- * -4 = noone
- * -3 = unsheathe
- * -2 = sheathe
- * -1 = taunt
- * 0 = north hold
- * 1 = north release
- * 2 = northeast hold
- * 3 = northeast release
- * 4 = east hold
- * 5 = east release
- * 6 = southeast hold
- * 7 = southeast release
- * 8 = south hold
- * 9 = south release
- * 10 = southwest hold
- * 11 = southwest release
- * 12 = west hold
- * 13 = west release
- * 14 = norhtwest hold
- * 15 = northwest release
- * 16 = north block
- * 17 = east block
- * 18 = south block
- * 19 = west block
- * 20 = shield block
- * 21 = throw pull
- * 22 = throw release
- * 23 = arrow draw
- * 24 = arrow release
- * 25 = arrow return
- * 26 = xbow reload crank
- * 27 = xbow reload pull
- * 28 = xbow aim
- * 29 = xbow fire
- * 30 = take damage
- */
- public int swing_state = -4;
- //weapon_kind
- /* Type of weapon currently equiped, used for animations.
- * 0 = none (fists)
- * 1 = onehanded
- * 2 = twohanded
- * 3 = polearm
- * 4 = throwing
- * 5 = bow
- * 6 = xbow
- */
- public int weapon_kind = 0;
- //ANIMATION/MOVEMENT END
- /*/////////////////////////////////////////////////
- * ACTION METHODS
- *///////////////////////////////////////////////////
- //
- // Use this for initialization
- void Start () {
- //set cursor as locked
- Cursor.lockState = CursorLockMode.Locked;
- }
- // Update is called once per frame
- void Update () {
- //CAMERA STUFF BEGIN
- float translation = Input.GetAxis("Vertical") * speed;
- float straffe = Input.GetAxis("Horizontal") * speed;
- translation *= Time.deltaTime;
- straffe *= Time.deltaTime;
- transform.Translate(straffe, 0, translation);
- if (Input.GetKeyDown("escape"))
- {
- Cursor.lockState = CursorLockMode.None;
- }
- if (Input.GetKeyDown("r"))
- {
- swapCameras();
- }
- //CAMERA STUFF END
- }
- void swapCameras()
- {
- //swap booleans
- firstPerson = !firstPerson;
- thirdPerson = !thirdPerson;
- //now actually swap the cameras
- firstPersonCamera.enabled = !firstPersonCamera.enabled;
- thirdPersonCamera.enabled = !firstPersonCamera.enabled;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement