public void Punch(GameObject enemy) { //animation aspect. must happen first GridUnit enemyGU = enemy.GetComponent <GridUnit>(); S.GridControlInst.MakeSquares(GridControl.TargetTypes.diamond, 0, 0, enemyGU.xPosition, enemyGU.yPosition, false); playerGU.PokeTowards(playerGU.AdjacentPosition(enemyGU)); enemy.GetComponent <Enemy> ().GetPunched(punchDamage); S.GameControlInst.AddPlays(-1); //triggers EventControl.EventCheck("Punch"); S.ShopControlInst.GoalCheck("Punch X times"); if (Tutorial.TutorialLevel != 0) { S.GameControlInst.gameObject.GetComponent <Tutorial>().TutorialTrigger(3); } QControl.CheckQ(); }
/// <summary> /// Main method 2; Executes whatever action is set to happen /// </summary> public void ReleaseCursor() { switch (currentCursorAction) { case CursorActions.Info: ShowInfo(); break; case CursorActions.StairMove: if (S.GameControlInst.MovesLeft > 0) { S.GameControlInst.AddMoves(-1); S.ShopControlInst.GoalCheck("Move X times in one turn"); S.ShopControlInst.GoalCheck("Don't move X turns in a row"); S.ShopControlInst.GoalCheck("Don't deal damage or move X turns in a row"); S.ShopControlInst.GoalCheck("Don't move X turns in a row"); } else { ButtonAnimate moveButton = GameObject.Find("move end button").GetComponent <ButtonAnimate>(); moveButton.ErrorAnimation(); } break; case CursorActions.Move: if (walkableObstacleToWalkInto != null) { walkableObstacleToWalkInto.StepIn(); } if (moveDirection != null) { playerObject.GetComponent <Player>().MoveClick(moveDirection); } else { Debug.LogError("there should be a move direction set already. oops"); } break; case CursorActions.Poke: GridUnit playerGU = playerObject.GetComponent <GridUnit>(); playerGU.PokeTowards(playerGU.AdjacentPosition(currentCursorTarget.GetComponent <GridUnit>())); break; case CursorActions.Punch: playerObject.GetComponent <Player>().Punch(currentCursorTarget); break; case CursorActions.TargetSquare: TargetSquare square = currentCursorTarget.GetComponent <TargetSquare>(); if (Tutorial.TutorialLevel != 0) { if (square.XCoor == 0 && square.YCoor == -2) { S.GameControlInst.gameObject.GetComponent <Tutorial>().TutorialTrigger(5); } else { S.GameControlInst.gameObject.GetComponent <Tutorial>().TutorialMessage = "iolksdcbelp"; return; } } S.GameControlInst.TargetSquareCallback.TargetSquareCalledThis(square.XCoor, square.YCoor); break; case CursorActions.None: break; default: Debug.Log("shouldn't be showing info! bug!"); break; } UnpresentCursor(); }