void Awake() { if (ActionsInterface.InitializeActionsInterface(GetActionDown, GetAction, GetActionUp, GetAxis, GetMousePos, 1, this)) { DontDestroyOnLoad(gameObject); } }
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; }
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); }
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); }
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); }
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); }