/** * Manages the end of the current hole * saveForStatistics : true to save the stats of the current hole, false to not save them */ public void holeFinished(bool saveForStatistics) { ScoreHole sh = StatistiquesGolf.saveForStats(this, itHole.Current, saveForStatistics); ScoreOfThisPartie.add(sh); Shots.Clear(); }
public void SetState(ShipState newState) { if (newState == state) { return; } lock (this) { switch (newState) { case ShipState.Dying: deathCount++; waitCount = Constants.DyingCycle; sounds |= Sounds.ShipExplode; vaporTrail.UpdateExplosion(450, shipMesh.Position.Location); shockWave.Reset(shipMesh.Position.Location); break; case ShipState.Dead: waitCount = Constants.DeadCycleWait; shipMesh.Position.Move(this.startingPosition); break; case ShipState.Normal: if (state == ShipState.Hyper) { SetRandomPosition(false); } else { shipMesh.Position.Move(startingPosition); velocity = 0.0f; } hyperSuccess = Constants.HyperSuccessFactor; shots.Clear(); sounds |= Sounds.ShipAppear; break; case ShipState.HyperCharge: sounds |= Sounds.ShipHyper; waitCount = Constants.HyperChargeWait; break; case ShipState.Hyper: waitCount = Constants.HyperCycleWait; break; } state = newState; } }
private IEnumerator PlayShots() { yield return(new WaitForSeconds(0.2f)); foreach (GameObject shooter in Shots) { GameObject prefab = shooter.CompareTag("Player") ? ManagedPrefabs.Bank[PrefabID.Bullet02] : ManagedPrefabs.Bank[PrefabID.Bullet01]; StartCoroutine(Bullet.SpawnBullets(shooter.GetComponent <Shooter>().ShotsPerTurn, prefab, shooter)); } yield return(new WaitForSeconds(Bullet.BulletFlyTime / 2)); Shots.Clear(); CurrentPhase.Value = Phase.Resolution; }