public static Component[] create_components(Fab5.Starburst.States.Playing.Game_Config conf, int team)
        {
            List <Component> components = new List <Component>(Fab5.Starburst.States.Playing.Entities.Player_Ship.create_components(new Input(), conf, team));

            Input input = (Input)components[0];

            components.RemoveAt(0);

            /*return new Component[] {
             *  new Angle           { },
             *
             *  new Bounding_Circle { radius = 16.0f },
             *
             *  new Brain           { think_fn       = think,
             *                        think_interval = THINK_INTERVAL },
             *
             *  new Data            { },
             *
             *  new Mass            { mass = 15.0f, friction = 0.0f, restitution_coeff = 0.4f },
             *
             *  new Position        { x = -1700.0f,
             *                        y = 1700.0f },
             *
             *  new Ship_Info(100.0f, 100.0f, 100.0f, 100.0f) { },
             *
             *  new Sprite          { texture = Fab5_Game.inst().get_content<Texture2D>("ships/ship1" + ai_counter) },
             *
             *  new Velocity        { x = 0.0f,
             *                        y = 0.0f },
             * };*/

            components.Add(
                new Brain {
                think_fn         = think,
                think_interval   = THINK_INTERVAL,
                time_since_think = (float)rand.NextDouble() * THINK_INTERVAL
            }
                );

            var data = new Data {
            };

            data.data["input"]            = input;
            data.data["ai_index"]         = string.Format("{0:00}", ai_index++);
            data.data["path_recalc_time"] = Fab5_Game.inst().get_time() - 0.5f + (float)rand.NextDouble() * 2.0f;

            //Console.WriteLine(data.data["path_recalc_time"]);

            data.data["courage_fac"]    = 1.0f + 3.0f * (float)Math.Pow((float)rand.NextDouble(), 3.0f);
            data.data["aggression_fac"] = 0.5f + 10.0f * (float)Math.Pow((float)rand.NextDouble(), 2.0f);
            data.data["greed_fac"]      = 0.2f + 10.0f * (float)Math.Pow((float)rand.NextDouble(), 3.0f);


            components.Add(data);

            return(components.ToArray());
        }
Esempio n. 2
0
 public Spawn_Util(Game_Config conf)
 {
     this.conf = conf;
 }
Esempio n. 3
0
        private void proceed()
        {
            int time = 5;

            if (gameTime == GameTime.Ten)
            {
                time = 10;
            }
            else if (gameTime == GameTime.Twenty)
            {
                time = 20;
            }
            else if (gameTime == GameTime.Thirty)
            {
                time = 30;
            }

            int asteroid = (asteroidCount == 0) ? 0 : maps[currentMapIndex].asteroidAmounts[(int)asteroidCount - 1];

            int powerup     = 0;
            int powerupTime = 0;

            if (powerupCount == Amount.few)
            {
                powerup     = 10;
                powerupTime = 20;
            }
            else if (powerupCount == Amount.medium)
            {
                powerup     = 15;
                powerupTime = 15;
            }
            else if (powerupCount == Amount.many)
            {
                powerup     = 20;
                powerupTime = 10;
            }

            btnDelay = BTN_DELAY;
            started  = false;
            Starburst.inst().message("play_sound", new { name = "menu_positive" });

            MapConfig selectedMap = maps[currentMapIndex];

            gameConfig = new Playing.Game_Config()
            {
                match_time         = time * 60,
                num_asteroids      = asteroid,
                num_powerups       = powerup == 0 ? 0 : redBots + blueBots + powerup,
                powerup_spawn_time = redBots + blueBots == 0 ? powerupTime : ((powerupTime - (int)((redBots + blueBots) * 0.5f)) <= 2 ? 2 : (powerupTime - (int)((redBots + blueBots) * 0.5f))),
                map_name           = selectedMap.fileName,
                mode          = selectedMap.gameMode,
                enable_soccer = selectedMap.soccerBall,
                soccer_mode   = selectedMap.soccerMode,
                red_bots      = (selectedMap.bots ? (selectedMap.gameMode == Playing.Game_Config.GM_TEAM_DEATHMATCH ? redBots : redBots) : 0),
                blue_bots     = (selectedMap.bots ? (selectedMap.gameMode == Playing.Game_Config.GM_TEAM_DEATHMATCH ? blueBots : 0) : 0)
            };
            MediaPlayer.Volume = 0.7f;
            vol  = 0.7f;
            fade = 1.0f;
            Starburst.inst().enter_state(new Player_Selection_Menu(this));
        }