void Awake()
 {
     if (ActionsInterface.InitializeActionsInterface(GetActionDown, GetAction, GetActionUp, GetAxis, GetMousePos, 1, this))
     {
         DontDestroyOnLoad(gameObject);
     }
 }
Esempio n. 2
0
        public void ShowActionPrompt(int promptIndex, string msg, List <int> actions, List <string> hints, float fadeIn = .1f)
        {
            string prompt = msg + " [";

            for (int i = 0; i < actions.Count; i++)
            {
                prompt += ActionsInterface.Action2String(actions[i]) + " : " + hints[i] + (i == actions.Count - 1 ? "]" : ", ");
            }
            showPrompt = prompt;
        }
Esempio n. 3
0
 public abstract class ActionsInterfaceController : GameSettingsObject {// MonoBehaviour {
     public void InitializeActionsInterface()
     {
         // void Awake () {
         // if (
         ActionsInterface.InitializeActionsInterface(
             GetActionDown, GetAction, GetActionUp, GetAxis,
             GetMousePos, GetMouseScrollDelta, GetMouseAxis,
             GetMouseButtonDown, GetMouseButton, GetMouseButtonUp,
             MaxControllers(), this
             );
         // )
         // DontDestroyOnLoad(gameObject);
     }
Esempio n. 4
0
        public override void UpdateLoop(float deltaTime)
        {
            Vector3 side   = transform.right * DecideAxis(move.x, negMove.x);
            Vector3 upDown = transform.up * DecideAxis(move.y, negMove.y);
            Vector3 fwd    = transform.forward * DecideAxis(move.z, negMove.z);

            transform.position += (side + upDown + fwd) * moveSpeed * deltaTime;

            float turnSpeed = this.turnSpeed * deltaTime;

            rotX += ActionsInterface.GetAxis(look.y) * turnSpeed;
            rotY += ActionsInterface.GetAxis(look.x) * turnSpeed;

            transform.rotation = Quaternion.Euler(rotX, rotY, 0);
        }
Esempio n. 5
0
        public override void UpdateLoop(float deltaTime)
        {
            Vector3 side   = transform.right * ActionsInterface.GetAxis(move.x);
            Vector3 upDown = transform.up * ActionsInterface.GetAxis(move.y);
            Vector3 fwd    = transform.forward * ActionsInterface.GetAxis(move.z);

            transform.position += (side + upDown + fwd) * (ActionsInterface.GetAction(speedUp) ? moveSpeedUp : moveSpeed) * deltaTime;

            float turnSpeed = this.turnSpeed * deltaTime;


            Vector3 angles = transform.rotation.eulerAngles;

            angles.z           = 0;
            angles.x          += ActionsInterface.GetAxis(look.y) * turnSpeed;
            angles.y          += ActionsInterface.GetAxis(look.x) * turnSpeed;
            transform.rotation = Quaternion.Euler(angles);
        }
Esempio n. 6
0
        float DecideAxis(int pos, int neg)
        {
            float axis = 0;

            if (neg >= 0)
            {
                if (ActionsInterface.GetAction(pos))
                {
                    axis += 1;
                }
                if (ActionsInterface.GetAction(neg))
                {
                    axis -= 1;
                }
            }
            else
            {
                axis = ActionsInterface.GetAxis(pos);
            }
            return(axis);
        }
 public void InitializeActionsInterface()
 {
     ActionsInterface.InitializeActionsInterface(this);
 }