コード例 #1
0
ファイル: GameState.cs プロジェクト: Numprt/Alien_Banjos
 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;
 }
コード例 #2
0
ファイル: GameState.cs プロジェクト: Numprt/Alien_Banjos
        public GameState(ACWGame game, int seed)
        {
            this.game = game;

            gameRand = new Random(seed);
            if (!(loaded = Load()))
            {
                player = new Accordian(150, 250);
            }
        }
コード例 #3
0
ファイル: Accordian.cs プロジェクト: Numprt/Alien_Banjos
        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;
        }
コード例 #4
0
ファイル: Banjo.cs プロジェクト: Numprt/Alien_Banjos
        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;
        }
コード例 #5
0
ファイル: Banjo.cs プロジェクト: Numprt/Alien_Banjos
 public Banjo(int x, int y, Accordian player, BanjoType type, GameState state = null)
 {
     Init(x, y);
     Init(type, player, state);
 }
コード例 #6
0
ファイル: Banjo.cs プロジェクト: Numprt/Alien_Banjos
 public Banjo(Accordian player, BanjoType type)
 {
     Init(0, 0);
     Init(type, player);
 }
コード例 #7
0
ファイル: Banjo.cs プロジェクト: Numprt/Alien_Banjos
 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;
 }
コード例 #8
0
ファイル: GameState.cs プロジェクト: Numprt/Alien_Banjos
 /// <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;
 }