static IEnumerator MoveFollowers() { moving = true; target = otherlist[0]; for (int n = 1; n < otherlist.Count; ++n) { MoveMaster.SetTarget(otherlist[n]); moveTo = otherlist[n].CurrentHex; moves = otherlist[n].MoveSpeed; openSpaces = MapMaster.CellsWithinArea(moveTo, moves); //finds nearby hexcells distance = Vector3.Distance(target.CurrentHex.transform.position, otherlist[n].CurrentHex.transform.position); //distance between current hex and target hex. for (int i = 1; i < openSpaces.Count; ++i) //loops through the rest of the cells { if (openSpaces[i].Unit == null && distance > Vector3.Distance(target.CurrentHex.transform.position, openSpaces[i].transform.position)) { moveTo = openSpaces[i]; distance = Vector3.Distance(target.CurrentHex.transform.position, openSpaces[i].transform.position); } } yield return(new WaitForSeconds(.2f)); MoveMaster.EvaluateTile(moveTo); //Actually moves unit } Debug.Log("1"); moving = false; }
// Drives the current behavior based on what phase of the game is taking place. void ManageTurn() { if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } switch (gP) { case (GamePhase.Deploy): DeployMaster.SetTiles(); // let users set units break; case (GamePhase.Cannon): CannonMaster.HandleCannons(); // let users turn and fire cannons break; case (GamePhase.Move): MoveMaster.DecideMove(); // let users move available units break; case (GamePhase.Attack): // Attack phase currently resolves itself with no need for user input break; default: break; } }
public static IEnumerator Move() { GameBrain.ChangeAcceptInput(false); yield return(new WaitForSeconds(1.0f)); HexCell moveTo; for (int i = 0; i < ai_units.Count; ++i) { if (ai_units[i] != null) { HexCell unit_cell = ai_units[i].CurrentHex; MoveMaster.SetTarget(ai_units[i]); moveTo = MapMaster.Map[ai_units[i].CurrentHex.R - 2, ai_units[i].CurrentHex.Q]; MoveMaster.EvaluateTile(moveTo); //Actually moves unit } } yield return(new WaitForSeconds(.75f)); while (MoveMaster.movingUnits != 0) { yield return(null); } yield return(GameBrain.ChangeTurn()); //GameBrain.ChangeAcceptInput(true); }
// Use this for initialization void Start() { front = true; moveM = FindObjectOfType <MoveMaster>(); myAnim = this.GetComponentInChildren <Animator>(); blood = particlesObj.GetComponent <ParticleSystem>(); }
void Start() { actualPos = this.transform.position; moveM = GameObject.FindGameObjectWithTag("MoveMaster").GetComponent <MoveMaster>(); myAnim = GetComponentInChildren <Animator>(); randomScale = Random.Range(0.8f, 1.2f); this.gameObject.transform.localScale = new Vector3(randomScale, randomScale, 1); }
private void Start() { moveM = GameObject.FindGameObjectWithTag("MoveMaster").GetComponent <MoveMaster>(); player = GameObject.FindGameObjectWithTag("Player").transform; playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); myAnim = GetComponentInChildren <Animator>(); rb = GetComponent <Rigidbody>(); //audioM = GameObject.FindGameObjectWithTag("SoundMaster").GetComponent<AudioMaster>(); }
void Start() { myAnim = GetComponentInChildren <Animator>(); moveM = GameObject.FindGameObjectWithTag("MoveMaster").GetComponent <MoveMaster>(); player = GameObject.FindGameObjectWithTag("Player").transform; playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); bossAttackTrigger = GameObject.Find("BossAttackTrigger"); bossAttackTrigger.SetActive(false); //spitScript = spitPrefab.GetComponent<BossSpite>(); }
public MoveMaster() { markerMat = (Material)Resources.Load("Pictures/Materials/" + markerName); radiusMarker = null; timePressed = 0.0f; uQue = new List <Unit>(); uSize = 0; instance = this; soundM = GameObject.Find("SoundMaster").GetComponent <SoundMaster>(); movingUnits = 0; }
void Start() { moveM = GameObject.FindGameObjectWithTag("MoveMaster").GetComponent <MoveMaster>(); sceneM = GameObject.FindGameObjectWithTag("SceneMaster").GetComponent <SceneMaster>(); player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent <Player>(); spitScript = spitPrefab.GetComponent <BossSpite>(); if (miniRangedBoss) { GetComponentInChildren <SpriteRenderer>().sprite = leftBoss; } else { GetComponentInChildren <SpriteRenderer>().sprite = rightBoss; } }
static IEnumerator MoveCannonFollowers() { moving = true; for (int i = 0; i < otherlist.Count; ++i) // loops through squad list to find everything else { if (otherlist[i].gameObject.tag != "cannon") { MoveMaster.SetTarget(otherlist[i]); target = otherlist[i]; moveTo = MapMaster.Map[target.CurrentHex.R - 2, target.CurrentHex.Q]; MoveMaster.EvaluateTile(moveTo); //Actually moves unit yield return(new WaitForSeconds(.2f)); } } Debug.Log("2"); moving = false; }
//initialize void Start() { instance = this; // canSkip = false; uiM = new UIMaster(); sM = new ScoreMaster(); mM = new MapMaster(); pM = new PlayerMaster(); dM = new DeployMaster(); mvM = new MoveMaster(); aM = new AttackMaster(); acceptInput = true; turnNum = 0; CannonMaster.ResetCurrent(); gP = GamePhase.Deploy; ScoreMaster.ResetScore(); mL = new MapLoader(); mL.LoadMapFromTextAsset(((TextAsset)Resources.Load("Maps/" + mapName))); PlayerMaster.SetBackLines(MapMaster.Map); TopDownCamera.ActivateMainCamera(MapMaster.Height, MapMaster.Width, MapMaster.MapRadius); UIMaster.SetGeneralUI(); UIMaster.SetDeployUI(); UIMaster.SetCannonUI(); UIMaster.DisplayScore(); UIMaster.SetPanelAlpha(false, (int)UIPannels.Cannon); UIMaster.SetPanelAlpha(false, (int)UIPannels.Phase); UIMaster.SetPanelAlpha(false, (int)UIPannels.View); UIMaster.SetPanelAlpha(false, (int)UIPannels.Fight); UIMaster.SetActionPanel(true); if (!tutorial) { UIMaster.DisplayState(gP, PlayerMaster.CurrentTurn); } // norton = VS_AI ? new AIBrain() : null; // must be called after UIMaster.SetGeneralUI to percive turns properly }
// changes the phase and "refreshes" variables as apropriate static IEnumerator EndofRound() { switch (gP) { case (GamePhase.Deploy): Debug.Log("Move from D"); MoveMaster.PrimeMoveVariables(PlayerMaster.OtherPlayer); PlayerMaster.RefreshMovement(); HighlightMaster.HighlightMovable(PlayerMaster.OtherPlayer); gP = GamePhase.Move; break; case (GamePhase.Cannon): Debug.Log("Move from C"); PlayerMaster.RefreshMovement(); if (PlayerMaster.CurrentTurn == 1) { MoveMaster.PrimeMoveVariables(PlayerMaster.OtherPlayer); HighlightMaster.HighlightMovable(PlayerMaster.OtherPlayer); } gP = GamePhase.Move; break; case (GamePhase.Move): Debug.Log("Cannon from M"); HighlightMaster.HighlightActiveCannons(PlayerMaster.OtherPlayer); yield return(WinBySize()); gP = GamePhase.Cannon; //CheckSkip(); break; case (GamePhase.Attack): Debug.Log("Move from A"); break; default: yield return(null); break; } }
static void MoveCannon() { Debug.Log("Move Cannons"); HexCell moveTo; List <Unit> inRangeTargets = new List <Unit>(); for (int i = 0; i < otherlist.Count; ++i) //searches squad list for the cannon. { if (otherlist[i].gameObject.tag == "cannon") { Debug.Log("Found Cannon"); if (GameBrain.turnNum < 4) { otherlist[i].Moved = false; otherlist[i].MoveSpeed = 2; } HexCell cannonCell = otherlist[i].CurrentHex; List <HexCell> inRangeCells = MapMaster.CellsWithinArea(cannonCell, 11); //Gets all HexCells within "range" of the current cannon for (int j = 0; j < inRangeCells.Count; ++j) { //If the cell has an enemy unit on it that is not a cannon it is added to the list if (inRangeCells[j].Unit != null && inRangeCells[j].Unit.Player != PlayerMaster.CurrentTurn && inRangeCells[j].Unit.gameObject.tag != "Cannon") { inRangeTargets.Add(inRangeCells[j].Unit); } } //if(inRangeTargets.Count < 0) // { MoveMaster.SetTarget(otherlist[i]); target = otherlist[i]; moveTo = MapMaster.Map[target.CurrentHex.R - 2, target.CurrentHex.Q]; MoveMaster.EvaluateTile(moveTo); //Actually moves unit // } } } }
static void MoveLeadSoldier() { MoveMaster.SetTarget(otherlist[0]); //Which unit it's about to move //moveTo is hexcell unit is trying to move to. Starts as the cell the Unit is already on moveTo = otherlist[0].CurrentHex; moves = otherlist[0].MoveSpeed; openSpaces = MapMaster.CellsWithinArea(moveTo, moves); //finds nearby hexcells distance = Vector3.Distance(target.CurrentHex.transform.position, otherlist[0].CurrentHex.transform.position); //distance between current hex and target hex. for (int i = 1; i < openSpaces.Count; ++i) //loops through the rest of the cells { if (openSpaces[i].Unit == null && distance > Vector3.Distance(target.CurrentHex.transform.position, openSpaces[i].transform.position)) { moveTo = openSpaces[i]; distance = Vector3.Distance(target.CurrentHex.transform.position, openSpaces[i].transform.position); } } openSpaces.Clear(); MoveMaster.EvaluateTile(moveTo); //Actually moves unit }
//Alters aspects of the game state (such as highlights or unit numbers) based on phase and other information private static IEnumerator AlterState() { switch (gP) { case (GamePhase.Deploy): if (DeployMaster.instance.uoList.Count != 0) { yield return(DeployMaster.DeployUnitsCoroutine()); yield return(new WaitForSeconds(1.5f)); } UIMaster.UpdateDeployAmount(); break; case (GamePhase.Cannon): // CheckSkip(); /* if (PlayerMaster.CurrentTurn == 0) * { * CheckSkip(); * } */ CannonMaster.ExitCannon(); HighlightMaster.UnhighlightCannons(PlayerMaster.CurrentPlayer); DeactivateCannonByCannon(PlayerMaster.OtherPlayer); if (PlayerMaster.CurrentTurn == 0) { //DeactivateCannonByMove(PlayerMaster.OtherPlayer); HighlightMaster.HighlightActiveCannons(PlayerMaster.OtherPlayer); } break; case (GamePhase.Move): if (MoveMaster.UnitsToMove != 0) { HighlightMaster.UnhighlightMovable(PlayerMaster.CurrentPlayer); MoveMaster.ClearMoveVariables(); } AttackMaster.BuildCombatAreas(); ActivateCannonByMove(PlayerMaster.CurrentPlayer); DeactivateCannonByMove(PlayerMaster.CurrentPlayer); if (AttackMaster.CombatCount == 0) { CannonMaster.CheckCannonCapture(); yield return(WinByMove()); if (PlayerMaster.CurrentTurn == 0) { MoveMaster.PrimeMoveVariables(PlayerMaster.OtherPlayer); HighlightMaster.HighlightMovable(PlayerMaster.OtherPlayer); } } else if (AttackMaster.CombatCount != 0) { // AttackMaster.BuildCombatAreas(); //gP = GamePhase.Attack; UIMaster.SetActionPanel(false); //Deactivates off action panel UIMaster.FadePhanel((int)UIPannels.Action); acceptInput = false; instance.StartCoroutine(Fight()); //yield return Fight(); } break; case (GamePhase.Attack): break; default: yield return(null); break; } }
void Update() { Debug.Log(PlayerMaster.PriorTurn); if (acceptInput) { switch (phase) { case T_Phases.Deploy: DeployMaster.SetTutorialTiles(); if (d_markers.transform.childCount == 0) { turn_button.interactable = true; } if (PlayerMaster.CurrentTurn == 1) { acceptInput = false; ai_turn = true; instance.StartCoroutine(TutorialAI.Deploy()); } break; case T_Phases.Move: MoveMaster.DecideMove(); if (PlayerMaster.CurrentTurn == 1) { acceptInput = false; ai_turn = true; instance.StartCoroutine(TutorialAI.Move()); } break; case T_Phases.Cannon: CannonMaster.HandleCannons(); if (PlayerMaster.CurrentTurn == 1) { acceptInput = false; ai_turn = true; instance.StartCoroutine(TutorialAI.IDontHaveCannons()); } break; case T_Phases.Fight: MoveMaster.DecideMove(); if (PlayerMaster.CurrentTurn == 1) { acceptInput = false; ai_turn = true; instance.StartCoroutine(TutorialAI.Move()); } break; default: Debug.Log("Default"); break; } } if (ai_turn) { if (PlayerMaster.CurrentTurn == 0) { ai_turn = false; TutorialUIMaster.c_bool = false; TutorialUIMaster.SetContinue(false); NextPhase(); instance.StartCoroutine(TutorialUIMaster.MoveTextbox()); } } }
// Use this for initialization void Start() { playerTransform = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); moveM = GameObject.FindGameObjectWithTag("MoveMaster").GetComponent <MoveMaster>(); }