public GameState(bool autoPlay) { this.autoPlay = autoPlay; if (!autoPlay) throw new Exception("Wrong Gamestate constructor used, check the code."); gameRand = new Random(8224271); player = new Accordian(150, ACWGame.HEIGHT - 100); player.autoPlay = true; }
public GameState(ACWGame game, int seed) { this.game = game; gameRand = new Random(seed); if (!(loaded = Load())) { player = new Accordian(150, 250); } }
public static Accordian ParseSaveString(String saveString) { if (saveString.StartsWith("[Accordian]")) { String subString = saveString.Substring(11); String[] split = subString.Split(','); double x = double.Parse(split[0]); double y = double.Parse(split[1]); int hp = int.Parse(split[2]); Accordian a = new Accordian((int)x, (int)y); a.hp = hp; return a; } return null; }
public static Banjo ParseSaveString(String saveString, Accordian player) { if (saveString.StartsWith("[Banjo]")) { String subString = saveString.Substring(7); String[] split = subString.Split(','); BanjoType type = (BanjoType)int.Parse(split[0]); double x = double.Parse(split[1]); double y = double.Parse(split[2]); int hp = int.Parse(split[3]); Banjo b = new Banjo(player, type); b.x = x; b.y = y; b.hp = hp; b.UpdateRect(); return b; } return null; }
public Banjo(int x, int y, Accordian player, BanjoType type, GameState state = null) { Init(x, y); Init(type, player, state); }
public Banjo(Accordian player, BanjoType type) { Init(0, 0); Init(type, player); }
public void Init(BanjoType type, Accordian player, GameState state = null) { if (type == BanjoType.Standard) { this.yVel = ACWGame.HEIGHT / 3; ai = new StandardBanjoAI(); } else if (type == BanjoType.Hunter) { this.ai = new HunterBanjoAI(player); } else if (type == BanjoType.DeadlyStrummer) { this.hp = 2; this.xVel = ACWGame.WIDTH / 2.8; this.yVel = ACWGame.HEIGHT / 4; this.ai = new DeadlyStrummerAI(player, state); } this.state = state; this.type = type; }
/// <summary> /// This method sets the Player variable in this class. /// </summary> /// <param name="a"> /// The accordian to set as the new player. /// </param> public void SetPlayer(Accordian a) { player = a; }