public void ChangeSides() { if (!game_over) { // Stop normal "end turn" text, if applicable FindObjectOfType <TurnText>().StopAndReset(); // Move "switch sides" text FindObjectOfType <MovingUI>().StartMoving(); if (Possession.team == Team.A) { current_phase = Phase.TeamBAct; Possession.team = Team.B; field_generator.GenerateField(1); StartCoroutine(StartRound()); } else { current_phase = Phase.TeamAAct; Possession.team = Team.A; field_generator.GenerateField(0); StartCoroutine(StartRound()); } FindObjectOfType <ShotClock>().Restart(); } }
public void GenerateSelectableLevelFields() { if (fieldGenerator == null) { fieldGenerator = GetComponent <FieldGenerator>(); } for (int i = 0; i < levelNodeFields.Length; i++) { List <FieldGenerator.Node> nodes = fieldGenerator.GenerateField(levelNodeFields[i].FieldSize, levelNodeFields[i].LevelStartDirection, levelNodeFields[i].SpiralCounting, levelNodeFields[i].StartCountingValue, levelNodeFields[i].IsHorizontal); foreach (FieldGenerator.Node node in nodes) { Vector2 gridPosition = node.Position + levelNodeFields[i].FieldPosition; Vector2 nodePositionOffset = new Vector2(node.Position.x * levelNodeFields[i].ObjectToBuild.transform.localScale.x, node.Position.y * levelNodeFields[i].ObjectToBuild.transform.localScale.y); Vector2 fieldPositionOffset = new Vector2(levelNodeFields[i].FieldPosition.x * levelNodeFields[i].ObjectToBuild.transform.localScale.x, levelNodeFields[i].FieldPosition.y * levelNodeFields[i].ObjectToBuild.transform.localScale.y); Vector2 positionOffset = nodePositionOffset + fieldPositionOffset; Vector2 gridSpacingOffset = new Vector2(positionOffset.x * gridSpacing.x, positionOffset.y * gridSpacing.y); Vector2 nodePosition = positionOffset + gridSpacingOffset; LevelProgressState status = gameStateModel.Get().CompletedLevels.Contains(node.Counter) ? LevelProgressState.Finished : LevelProgressState.Locked; ISelectableLevel levelNode = InstantiateSelectableLevel(levelNodeFields[i].ObjectToBuild, gameObject, nodePosition, node.Counter, status); selectableLevels.Add(gridPosition, levelNode); } } }
void Awake() { current_phase = Phase.TeamAAct; field_generator = FindObjectOfType <FieldGenerator>(); field_generator.GenerateField(0); StartCoroutine(StartRound()); Utils.DehighlightTiles(); }
void Start() { if (difficulty == Team.Empty) { difficulty = Team.Red; } field.ySize = field.xSize = size; field2.ySize = field2.xSize = size; field2.GenerateField(); field.GenerateField(); StartGame(); }
public void ChangeSides(bool shot_clock_out = false) { // Tutorial if (Progression.level == 0) { FindObjectOfType <TutorialController>().Scored(); return; } if (!game_over) { Possession.passes_this_turn = 0; GetComponent <AIController>().StopAllCoroutines(); // Stop normal "end turn" text, if applicable FindObjectOfType <TurnText>().StopAndReset(); // Move "switch sides" text FindObjectOfType <MovingUI>().StartMoving(shot_clock_out); if (Possession.team == Team.A) { current_phase = Phase.TeamBAct; Possession.team = Team.B; field_generator.GenerateField(); StartCoroutine(StartRound()); } else { current_phase = Phase.TeamAAct; Possession.team = Team.A; field_generator.GenerateField(); StartCoroutine(StartRound()); } FindObjectOfType <ShotClock>().Restart(); FindObjectOfType <TimeCounter>().DecreaseTime(); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); FieldGenerator generator = (FieldGenerator)target; if (GUILayout.Button("Create field!")) { generator.GenerateField(); } if (GUILayout.Button("Clear field!")) { generator.ClearField(); } }
void Awake() { Possession.team = Team.A; if (Possession.team == Team.A) { current_phase = Phase.TeamAAct; } else { current_phase = Phase.TeamBAct; } field_generator = FindObjectOfType <FieldGenerator>(); field_generator.GenerateField(); StartCoroutine(StartRound()); Utils.DehighlightTiles(); }
public void NewField() { //DestroyChildren(); DestroyObjects(Visualf); SpriteRenderer b = Sprites[0].GetComponent <SpriteRenderer>(); Vector3 size = b.bounds.size; float px = b.sprite.pixelsPerUnit; GhostX = (TWidth / 2) - (GhostW + 1) / 2; field = FieldGenerator.GenerateField(rand.Next(-1000, 1000), TWidth, THeight, GhostY, GhostW, GhostH); float xr = size.x / px; float yr = size.y / px; Size = new Vector3(xr, yr, 0); transform.localScale = new Vector3(TWidth * xr, THeight * yr, 1); wh = (TWidth / 2.0f); hh = (THeight / 2.0f); wr = (transform.localScale.x / TWidth); hr = (transform.localScale.y / THeight); Visualf = fillTiles(Sprites, field, TWidth, THeight, Size, transform); // transform.localScale = new Vector3(TWidth * xr-(xr/2), THeight * yr-(yr/2), 1); }
void Start() { fieldgenerator.GenerateField(); unitgenerator.GenerateUnits(); }