public override void OnInspectorGUI() { base.OnInspectorGUI(); ChangeRotation c = (ChangeRotation)target; if (GUILayout.Button("Set min rotation")) { c.minRotation = c.transform.localRotation.eulerAngles; } if (GUILayout.Button("Set max rotation")) { c.maxRotation = c.transform.localRotation.eulerAngles; } if (GUILayout.Button("reset to min")) { c.transform.localRotation = Quaternion.Euler(c.minRotation); } if (GUILayout.Button("Invert values")) { Vector3 temp = c.minRotation; c.minRotation = c.maxRotation; c.maxRotation = temp; } }
// Use this for initialization void Awake() { changeRotation = new ChangeRotation(); animator = this.GetComponent <Animator>(); oldState = State.JUMP; curState = State.JUMP; nowIndex = 0; dispearEffect = GameObject.Find("DisappearEffect").GetComponent <ParticleSystem>(); ghostLight = GameObject.Find("GhostController").GetComponent <GhostController>().lightPrefab; heightOffset = GameObject.FindGameObjectWithTag("Player").GetComponent <CapsuleCollider>().bounds.extents.y; }
public PlayerState() { player = GameObject.FindGameObjectWithTag("Player"); checkOnGround = new CheckOnGround(); inputHandle = new InputHandle(); changeRotation = new ChangeRotation(); animator = player.GetComponent <Animator>(); rigidbody = player.GetComponent <Rigidbody>(); stateMachine = player.GetComponent <PlayerStateMachine>(); moveVec = Vector3.zero; input = InputKey.NONE; }