private void PlayerInput() { // Weapon Selection if (Input.GetKeyDown(KeyCode.Q)) { SelectWeapon(-1); } if (Input.GetKeyDown(KeyCode.E)) { SelectWeapon(1); } // Player Movement & turn advancement if (Input.GetKeyDown(KeyCode.W)) { transform.rotation = Quaternion.AngleAxis(0, Vector3.forward); currentlyFacing = Vector2Int.up; movePattern.SetMovePatternUp(); } if (Input.GetKeyDown(KeyCode.S)) { transform.rotation = Quaternion.AngleAxis(180.0f, Vector3.forward); currentlyFacing = Vector2Int.down; movePattern.SetMovePatternDown(); } if (Input.GetKeyDown(KeyCode.A)) { transform.rotation = Quaternion.AngleAxis(90.0f, Vector3.forward); currentlyFacing = Vector2Int.left; movePattern.SetMovePatternLeft(); } if (Input.GetKeyDown(KeyCode.D)) { transform.rotation = Quaternion.AngleAxis(-90.0f, Vector3.forward); currentlyFacing = Vector2Int.right; movePattern.SetMovePatternRight(); } if (Input.GetKeyDown(KeyCode.F)) { IsAttackingThisTick = true; if (OnPlayerAdvance != null) { OnPlayerAdvance(); } } if (Input.GetKeyDown(KeyCode.Space)) { if (OnPlayerAdvance != null) { OnPlayerAdvance(); } } if (Input.GetKeyDown(KeyCode.T)) { // Debug button } }
// METHODS public virtual void Init(string spawnBorder) { currentMode = GridObject.Mode.Spawn; Health hp = GetComponent <Health>(); if (hp != null) { hp.ToggleInvincibility(true); } MovePattern movement = GetComponent <MovePattern>(); if (movement != null) { switch (spawnBorder) { case "Bottom": movement.SetMovePatternUp(); break; case "Top": if (spawnRules.requiresOrientation) { transform.rotation = Quaternion.Euler(0.0f, 0.0f, 180.0f); spawnWarningObject.transform.localRotation = Quaternion.Euler(0.0f, 0.0f, 180.0f); } movement.SetMovePatternDown(); break; case "Right": if (spawnRules.requiresOrientation) { transform.rotation = Quaternion.Euler(0.0f, 0.0f, 90.0f); spawnWarningObject.transform.localRotation = Quaternion.Euler(0.0f, 0.0f, 270.0f); } movement.SetMovePatternLeft(); break; case "Left": if (spawnRules.requiresOrientation) { transform.rotation = Quaternion.Euler(0.0f, 0.0f, 270.0f); spawnWarningObject.transform.localRotation = Quaternion.Euler(0.0f, 0.0f, 90.0f); } movement.SetMovePatternRight(); break; } } Rotator r = GetComponent <Rotator>(); if (r != null) { if (!r.enabled) { r.enabled = true; } r.ApplyRotation(spawnBorder); } //ticksRemainingUntilMove = ticksPerMove; SetGamePlayMode(Mode.Spawn); }