public void SwapVirusPlace(EnvironmentVirus.Type type) { EnvironmentVirus virus = GetVirus(type); EnvironmentVirus installer = GetVirus(EnvironmentVirus.Type.INSTALLER); EnvironmentPosition savedPos = virus.Pos; virus.Move(installer.Pos); installer.Move(savedPos); }
private Color GetColorFromType(EnvironmentVirus.Type type) { return(type switch { EnvironmentVirus.Type.CORONA => Color.red, EnvironmentVirus.Type.FLU => Color.blue, EnvironmentVirus.Type.PLAGUE => Color.green, _ => throw new Exception("Invalid environment virus type (or installer which is forbidden here): " + type), });
private EnvironmentVirus GetVirus(EnvironmentVirus.Type type) { foreach (EnvironmentVirus virus in _viruses) { if (virus.type == type) { return(virus); } } return(null); }
private void VirusTurn() { Debug.Log("Ennemy turn"); _spellManager.IncreaseTurn(); EnvironmentVirus.Type type = _actionQueue.Peek(); _environment.SwapVirusPlace(type); _board.SpawnVirus((Board.Direction)_environment.GetInstallerPlace()); _actionQueue.Next(); _turn = 0; }