Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityStandardAssets.Characters.FirstPerson;
- using System.Collections.Generic;
- using UnityEngine.UI;
- public class Player : MonoBehaviour {
- public static Player Instance = null;
- CharacterController controller;
- public float walkSpeed = 6.0F;
- public float runSpeed = 9.0f;
- public float jumpSpeed = 8.0F;
- public float gravity = 20.0F;
- private Vector3 moveDirection = Vector3.zero;
- public HandlerPlayerStats HandlerPlayerStats;
- public SimpleMouseLook CameraLook;
- public SimpleMouseLook PlayerLook;
- void Awake()
- {
- Instance = this;
- controller = GetComponent<CharacterController>();
- }
- void Start()
- {
- Init();
- }
- private void Init()
- {
- HandlerPlayerStats.Init();
- }
- void Update()
- {
- Vector2 axis = GameManager.Instance.GetAxisMove();
- if (controller.isGrounded)
- {
- moveDirection = new Vector3(axis.x, 0, axis.y);
- moveDirection = transform.TransformDirection(moveDirection);
- }
- moveDirection.y -= gravity * Time.deltaTime;
- controller.Move(moveDirection * Time.deltaTime);
- }
- public void AddSatiety(int value)
- {
- //Satiety += value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement