Example #1
0
 protected WorldObject(Player owner, BattleField battfield) 
 {
     this.Owner = owner;
     this.battleField = battfield;
     //fsmMachine = new FSMMachine(this);
     //this.IsSelected = false;
 }
Example #2
0
        public Quest(Code2015 game, Game parent, GameScene scene, GameState gamelogic)
        {
            this.scene = scene;
            this.renderSys = game.RenderSystem;
            this.gameLogic = gamelogic;
            this.parent = parent;
            this.game = game;

            FileLocation fl = FileSystem.Instance.Locate("nig_quest.tex", GameFileLocs.GUI);
            background = UITextureManager.Instance.CreateInstance(fl);

            player = gamelogic.LocalHumanPlayer;

            fedge6 = GameFontManager.Instance.FRuanEdged8;
        }
Example #3
0
        public GatherCity(BattleField btfld, Player owner, CityType type)
            : base(btfld, owner, type)
        {
            harvester = new Harvester(this, btfld.Map);
            harvester.GotHome += Harv_Home;
            harvester.GotThere += Harv_Dest;

            Harvester.Props hprop = getHarvProps();
            harvester.SetProps(hprop);

            
            if (this.Type == CityType.Oil)
            {
                gatherDistance = RulesTable.OilGatherDistance;
            }
            else if (this.Type == CityType.Green)
            {
                gatherDistance = RulesTable.GreenGatherDistance;
            }
           
        }
Example #4
0
        public static void Test()
        {
            Player player = new Player("");
            SimulationRegion region = new SimulationRegion();

            City city = new City(region);
            City city2 = new City(region);

            IniSection sect = new IniSection("");
            sect.Add("Name", "HUST");
            sect.Add("Longitude", "0");
            sect.Add("Latitude", "0");
            sect.Add("Population", "150");
            sect.Add("Size", UrbanSize.Large.ToString());

            city.Parse(sect);



            sect = new IniSection("");
            sect.Add("Name", "Home");
            sect.Add("Longitude", "1");
            sect.Add("Latitude", "0");
            sect.Add("Population", "1");
            sect.Add("Size", UrbanSize.Small.ToString());

            city2.Parse(sect);

            region.Add(city);
            //region.Add(city2);

            //city.AddNearbyCity(city2);
            //city2.AddNearbyCity(city);



            OilField oilFld = new OilField(region);
            sect = new IniSection("");
            sect.Add("Amount", "100000");
            sect.Add("Latitude", "1");
            sect.Add("Longitude", "0");
            oilFld.Parse(sect);
            region.Add(oilFld);


            CityPluginType plgType = new CityPluginType();
            sect = new IniSection("");
            sect.Add("Cost", "100");
            sect.Add("HRCSpeed", "100");
            sect.Add("Behaviour", CityPluginBehaviourType.CollectorFactory.ToString());
            plgType.Parse(sect);

            CityPlugin plg = new CityPlugin(plgType, CityPluginTypeId.OilRefinary);
            city.Add(plg);



            plgType = new CityPluginType();
            sect = new IniSection("");
            sect.Add("Cost", "100");
            sect.Add("FoodConvRate", "0.50");
            sect.Add("FoodCostSpeed", "100");
            sect.Add("Behaviour", CityPluginBehaviourType.CollectorFactory.ToString());
            plgType.Parse(sect);
            plg = new CityPlugin(plgType, CityPluginTypeId.BiofuelFactory);
            city.Add(plg);



            //OilField oil = new OilField(region);
            //Forest forest = new Forest(region);
            float c = 0;
            while (true)
            {
                Console.Clear();
                Console.WriteLine("Energy Status:");
                Console.Write(" Current Food Storage   ");
                Console.WriteLine(region.EnergyStatus.CurrentFood);
                Console.Write(" Current HR Storage   ");
                Console.WriteLine(region.EnergyStatus.CurrentHR);
                Console.Write(" Current LR Storage   ");
                Console.WriteLine(region.EnergyStatus.CurrentLR);
                Console.Write(" Current Natural HR   ");
                Console.WriteLine(region.EnergyStatus.RemainingHR);
                Console.Write(" Current Natural LR   ");
                Console.WriteLine(region.EnergyStatus.RemainingLR);



                Console.WriteLine("City :" + city.Name);
                Console.WriteLine("City Status:");
                Console.Write(" Development   ");
                Console.WriteLine(city.Development);
                Console.Write(" Population   ");
                Console.WriteLine(city.Population);
                Console.Write(" Disease   ");
                Console.WriteLine(city.Disease);
                Console.Write(" Size   ");
                Console.WriteLine(city.Size);

                Console.WriteLine(" Local  H[{0}] L[{1}] F[{2}]", city.LocalHR.Current, city.LocalLR.Current, city.LocalFood.Current);
                Console.WriteLine(" Drain  H[{0}] L[{1}] F[{2}]", city.GetSelfHRCSpeed(), city.GetSelfLRCSpeed(), city.GetSelfFoodCostSpeed());
                Console.WriteLine(" Ratio  H[{0:P}] L[{1:P}] F[{2:P}]", city.SelfHRCRatio, city.SelfLRCRatio, city.SelfFoodCostRatio);

                c += city.GetCarbonChange();

                //city.LocalFood.Commit(250);
                //city.LocalHR.Commit(250);
                city.LocalLR.Commit(100);

                //Console.WriteLine("City :" + city2.Name);
                //Console.WriteLine("City Status:");
                //Console.Write(" Development   ");
                //Console.WriteLine(city2.Development);
                //Console.Write(" Population   ");
                //Console.WriteLine(city2.Population);
                //Console.Write(" Disease   ");
                //Console.WriteLine(city2.Disease);
                //Console.Write(" Size   ");
                //Console.WriteLine(city2.Size);

                //Console.WriteLine(" Local  H[{0}] L[{1}] F[{2}]", city2.LocalHR.Current, city2.LocalLR.Current, city2.LocalFood.Current);
                //Console.WriteLine(" Drain  H[{0}] L[{1}] F[{2}]", city2.GetSelfHRCSpeed(), city2.GetSelfLRCSpeed(), city2.GetSelfFoodCostSpeed());
                //Console.WriteLine(" Ratio  H[{0:P}] L[{1:P}] F[{2:P}]", city2.SelfHRCRatio, city2.SelfLRCRatio, city2.SelfFoodCostRatio);


                //c += city2.GetCarbonChange();


                Console.WriteLine("World Carbon {0}", c);

                GameTime gt = new GameTime(0, 0, TimeSpan.FromHours(1), TimeSpan.FromHours(1));
                region.Update(gt);

                Thread.Sleep(5);
            }
        }
Example #5
0
        public void InitialStandards()
        {

            Dictionary<int, FastList<City>> startAreas = new Dictionary<int, FastList<City>>();
            for (int i = 0; i < battleField.CityCount; i++)
            {
                City cc = battleField.Cities[i];
                if (cc.StartUp != -1)
                {
                    FastList<City> list;
                    if (!startAreas.TryGetValue(cc.StartUp, out list))
                    {
                        list = new FastList<City>();
                        startAreas.Add(cc.StartUp, list);
                    }

                    list.Add(cc);
                }
            }

            #region 确定玩家起始城市
            ExistTable<int> startAreaTable = new ExistTable<int>(startAreas.Count);

            for (int i = 0; i < localPlayerArea.Length; i++)
            {
                localPlayerArea[i] = new PlayerArea(battleField, localPlayers[i]);

                if (localPlayers[i].Type == PlayerType.LocalHuman)
                    LocalHumanPlayer = localPlayers[i];

                localPlayers[i].SetArea(localPlayerArea[i]);
                localPlayers[i].SetParent(this);



                bool finished = false;
                while (!finished)
                {
                    int area = Randomizer.GetRandomInt(startAreas.Count) + 1;

                    if (!startAreaTable.Exists(area))
                    {
                        startAreaTable.Add(area);
                        FastList<City> list = startAreas[area];

                        int cidx = Randomizer.GetRandomInt(list.Count);
                        list[cidx].IsHomeCity = true;
                        list[cidx].ChangeOwner(localPlayers[i]);

                        //list[cidx].TestBalls();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        list[cidx].ProduceBall();
                        //if (localPlayers[i].Type == PlayerType.LocalHuman)
                        //{
                        //    for (int k = 0; k < 20; k++)
                        //        list[cidx].ProduceBall();
                        //}

                        finished = true;
                    }
                }
            }
            #endregion

        }
Example #6
0
        public GameState(Player[] localPlayer)
        {
            this.battleField = new BattleField();// srcState.Field;
            //PluginFactory = srcState.PluginFactory;

            this.localPlayerArea = new PlayerArea[localPlayer.Length];
            this.localPlayers = localPlayer;


        }
Example #7
0
        public virtual void ChangeOwner(Player player)
        {
            if (Owner != player)
            {
                if (IsCaptured)
                {
                    Owner.Area.NotifyLostCity(this);
                }
                this.Owner = player;

                if (IsCaptured)
                {
                    Owner.Area.NotifyNewCity(this);
                }
                ChangeType();
                RefreshNearbyBalls();

                if (player != null)
                {
                    ChangeState(CityState.WakeingUp);
                    for (int i = 0; i < linkableCity.Count; i++)
                    {
                        linkableCity[i].NotifyNearbyCityCaptured(this);
                    }
                }
            }
        }
Example #8
0
 private static int ComparePlayer(Player a, Player b)
 {
     return b.Area.CityCount.CompareTo(a.Area.CityCount);
 }
Example #9
0
 public ProductionCity(BattleField btfld, Player owner, CityType type)
     : base(btfld, owner, type)
 {
     generateRBallTime = ResetGenerateRBallCD(Type);
     generateRBallCD = generateRBallTime;
 }
Example #10
0
        public Cursor(Code2015 game, Game parent, GameScene scene, GameState gamelogic, Picker picker,
             CitySelectInfo citySelectInfo, ObjectSelectInfo objSelectInfo, RBallTypeSelect sendBallSelect, MiniMap map, SelectionMarker marker, RankInfo rankInfo)
        {
            this.parent = parent;
            this.logic = gamelogic;
            this.player = gamelogic.LocalHumanPlayer;
            this.rankInfo = rankInfo;

            this.game = game;
            this.renderSys = game.RenderSystem;
            this.scene = scene;

            this.picker = picker;

            this.selectionMarker = marker;
            this.citySelectInfo = citySelectInfo;
            this.objSelectInfo = objSelectInfo;
            this.sendBallSelect = sendBallSelect;
            this.miniMap = map;

            FileLocation fl = FileSystem.Instance.Locate("cursor.tex", GameFileLocs.GUI);
            cursor = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("cursor_u.tex", GameFileLocs.GUI);
            cursor_up = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("cursor_l.tex", GameFileLocs.GUI);
            cursor_left = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("cursor_d.tex", GameFileLocs.GUI);
            cursor_down = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("cursor_r.tex", GameFileLocs.GUI);
            cursor_right = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("cursor_lu.tex", GameFileLocs.GUI);
            cursor_ul = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("cursor_ru.tex", GameFileLocs.GUI);
            cursor_ur = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("cursor_ld.tex", GameFileLocs.GUI);
            cursor_dl = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("cursor_rd.tex", GameFileLocs.GUI);
            cursor_dr = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("cursor_move.tex", GameFileLocs.GUI);
            cursor_move = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("cursor_stop.tex", GameFileLocs.GUI);
            cursor_stop = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("cursor_toofar.tex", GameFileLocs.GUI);
            cursor_toofar = UITextureManager.Instance.CreateInstance(fl);

            cursor_sel = new Texture[11];

            for (int i = 0; i < cursor_sel.Length; i++)
            {
                fl = FileSystem.Instance.Locate("selcursor" + (i + 13).ToString("D2") + ".tex", GameFileLocs.GUI);
                cursor_sel[i] = UITextureManager.Instance.CreateInstance(fl);
            }

            cursor_attack = new Texture[11];
            for (int i = 0; i < cursor_attack.Length; i++)
            {
                fl = FileSystem.Instance.Locate("selcursor" + (i + 1).ToString("D2") + ".tex", GameFileLocs.GUI);
                cursor_attack[i] = UITextureManager.Instance.CreateInstance(fl);
            }

            cursorState = MouseCursor.Normal;

        }
Example #11
0
 CursorColor getColor(Player owner)
 {
     if (owner == player)
         return CursorColor.White;
     if (owner == null)
         return CursorColor.Yellow;
     return CursorColor.Red;
 }
Example #12
0
        public RBall(Player owner, City city, RBallType type)
            : base(owner)
        {
            this.Owner = owner;
            this.Type = type;


            switch (type) 
            {
                case RBallType.Oil:
                    {
                        props.BaseMaxHealth = RulesTable.OilBallBaseHealth;
                        props.MaxHealth = props.BaseMaxHealth * (city.Level / 10.0f + 1);
                        props.Contribution = RulesTable.OilBallContribution;
                        props.Heal = RulesTable.OilBallBaseHeal;
                        props.Damage = RulesTable.OilBallBaseDamage;
                        
                        break;
                    }
                case RBallType.Green:
                    {
                        props.BaseMaxHealth = RulesTable.GreenBallBaseHealth;
                        props.MaxHealth = props.BaseMaxHealth * (city.Level / 10.0f + 1);
                        props.Contribution = RulesTable.GreenBallContribution;
                        props.Heal = RulesTable.GreenBallBaseHeal;
                        props.Damage = RulesTable.GreenBallBaseDamage;

                        break;
                    }
                case RBallType.Disease:
                    {
                        props.BaseMaxHealth = RulesTable.DiseaseBallBaseHealth;
                        props.MaxHealth = props.BaseMaxHealth * (city.Level / 10.0f + 1);
                        props.Contribution = RulesTable.DiseaseBallContribution;
                        props.Heal = RulesTable.DiseaseBallBaseHeal;
                        props.Damage = RulesTable.DiseaseBallBaseDamage;
                        props.HealthIncr = 0.0015f;
                        break;
                    }
                case RBallType.Health:
                    {
                        props.BaseMaxHealth = RulesTable.DiseaseBallBaseHealth;
                        props.MaxHealth = props.BaseMaxHealth * (city.Level / 10.0f + 1);
                        props.Contribution = RulesTable.HealthBallContribution;
                        props.Heal = RulesTable.HealthBallBaseHeal;
                        props.Damage = RulesTable.HealthBallBaseDamage;
                        props.HealthIncr = 0.0015f;
                        break;
                    }
                case RBallType.Education:
                    {
                        props.BaseMaxHealth = RulesTable.EducationBallBaseHealth;
                        props.MaxHealth = props.BaseMaxHealth * (city.Level / 10.0f + 1);
                        props.Contribution = RulesTable.EducationBallContribution;
                        props.Heal = RulesTable.EducationBallBaseHeal;
                        props.Damage = RulesTable.EducationBallBaseDamage;

                        break;
                    }
                case RBallType.Volience:
                    {
                        props.BaseMaxHealth = RulesTable.VolienceBallBaseHealth;
                        props.MaxHealth = props.BaseMaxHealth + city.Development * RulesTable.CityDevRBallHealthRate;
                        props.Contribution = RulesTable.VolienceBallContribution;
                        props.Heal = RulesTable.VolienceBallBaseHeal;
                        props.Damage = RulesTable.VolienceBallBaseDamage;

                        break;
                    }            
            }
            Health = props.MaxHealth;

            SetDockCity(city);

            currentRadius = NextRadius();
            currentHeight = NextHeight();


            refrenceLinSpeed = Randomizer.GetRandomSingle() * (MaxLinSpeed - MinLinSpeed) + MinLinSpeed;
            BoundingSphere.Radius = 15;
        }
Example #13
0
        public ObjectSelectInfo(Code2015 game, Game parent, GameScene scene, GameState gamelogic)
        {
            this.scene = scene;
            this.renderSys = game.RenderSystem;
            this.player = parent.HumanPlayer;
            this.gameLogic = gamelogic;
            this.parent = parent;
            this.game = game;


            #region Harv
            FileLocation fl = FileSystem.Instance.Locate("nig_status_harv_bk.tex", GameFileLocs.GUI);
            statusHarvBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_harv_hpbar_edge.tex", GameFileLocs.GUI);
            statusHPBarBarEdge = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_harv_hpbar_value.tex", GameFileLocs.GUI);
            statusHPBarBarValue = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_harv_stbar_edge.tex", GameFileLocs.GUI);
            statusSTBarBarEdge = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_harv_stbar_value.tex", GameFileLocs.GUI);
            statusSTBarBarValue = UITextureManager.Instance.CreateInstance(fl);

            #endregion


            fl = FileSystem.Instance.Locate("nig_status_empty.tex", GameFileLocs.GUI);
            statusEmptyBackground = UITextureManager.Instance.CreateInstance(fl);


            #region Green
            fl = FileSystem.Instance.Locate("nig_status_green_bk.tex", GameFileLocs.GUI);
            statusGreenBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_green_bar_edge.tex", GameFileLocs.GUI);
            statusGreenBarEdge = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_green_bar_value.tex", GameFileLocs.GUI);
            statusGreenBarValue = UITextureManager.Instance.CreateInstance(fl);
            #endregion

            #region Oil

            fl = FileSystem.Instance.Locate("nig_status_oil_bk.tex", GameFileLocs.GUI);
            statusOilBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_oil_bar_edge.tex", GameFileLocs.GUI);
            statusOilBarEdge = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_oil_bar_value.tex", GameFileLocs.GUI);
            statusOilBarValue = UITextureManager.Instance.CreateInstance(fl);

            #endregion

            fl = FileSystem.Instance.Locate("nig_harv_hp_edge.tex", GameFileLocs.GUI);
            harvHPBorader = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("nig_harv_hp_value.tex", GameFileLocs.GUI);
            harvHPValue = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("nig_harv_hp_bg.tex", GameFileLocs.GUI);
            harvHPBarBackground = UITextureManager.Instance.CreateInstance(fl);

            f8 = GameFontManager.Instance.FRuanEdged8;
            f6 = GameFontManager.Instance.FRuanEdged6;


        }
Example #14
0
        public City(BattleField btfld, Player owner, CityType type)
            : base(owner, btfld)
        {
            this.battleField = btfld;
            this.Type = type;


            BoundingSphere.Radius = CityRadius;
        }
Example #15
0
 public bool HasOwnedBalls(Player player)
 {
     for (int i = 0; i < nearbyEnemyBalls.Count; i++)
     {
         if (nearbyEnemyBalls[i].Owner == player)
         {
             return true;
         }
     }
     return false;
 }
Example #16
0
        public CitySelectInfo(Code2015 game, Game parent, GameScene scene, GameState gamelogic)
        {
            this.scene = scene;
            this.renderSys = game.RenderSystem;
            this.player = parent.HumanPlayer;
            this.gameLogic = gamelogic;
            this.parent = parent;
            this.game = game;

            FileLocation fl = FileSystem.Instance.Locate("nig_status_bk.tex", GameFileLocs.GUI);
            statusBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_enemyCity.tex", GameFileLocs.GUI);
            statusEnemyBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_hp_group.tex", GameFileLocs.GUI);
            statusHPBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_exp_bk.tex", GameFileLocs.GUI);
            statusExpBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_hp.tex", GameFileLocs.GUI);
            statusHPTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_exp.tex", GameFileLocs.GUI);
            statusExpTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_exp_buff.tex", GameFileLocs.GUI);
            statusExpBuffTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_hp_buff.tex", GameFileLocs.GUI);
            statusHPBufferTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_expdown_buff.tex", GameFileLocs.GUI);
            statusExpdownBuff = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_city_hp_group.tex", GameFileLocs.GUI);
            onCityHPBackground = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_city_hp.tex", GameFileLocs.GUI);
            onCityHPTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_city_hp_bk.tex", GameFileLocs.GUI);
            onCityHPBase = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_icon_green.tex", GameFileLocs.GUI);
            greenBallTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_icon_edu.tex", GameFileLocs.GUI);
            educationBallTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_icon_hospital.tex", GameFileLocs.GUI);
            healthBallTex = UITextureManager.Instance.CreateInstance(fl);

            fl = FileSystem.Instance.Locate("nig_status_city_produceprg.tex", GameFileLocs.GUI);
            statusProducePrgTex = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("nig_max_balls.tex", GameFileLocs.GUI);
            statusMaxBalls = UITextureManager.Instance.CreateInstance(fl);

            resBallsCount[0].Type = RBallType.Green;
            resBallsCount[0].count = 0;

            resBallsCount[1].Type = RBallType.Education;
            resBallsCount[1].count = 0;

            resBallsCount[2].Type = RBallType.Health;
            resBallsCount[2].count = 0;

            f8 = GameFontManager.Instance.FRuanEdged8;
            f6 = GameFontManager.Instance.FRuanEdged6;

        }
Example #17
0
        public override void ChangeOwner(Player player)
        {
            base.ChangeOwner(player);

            Harv_Home(null, EventArgs.Empty);
        }
Example #18
0
        //public float GetTotalDevelopment()
        //{
        //    float result = 0;
        //    for (int i = 0; i < cities.Count; i++)
        //    {
        //        result += cities[i].Development;
        //    }
        //    return result;
        //}

        public PlayerArea(BattleField region, Player player)
        {
            this.simulator = region;
            this.owner = player;
        }
Example #19
0
        public SelectionMarker(RenderSystem rs, BattleField btfld, Player player)
            : base(false)
        {
            this.battleField = btfld;
            this.player = player;
            this.linkArrow = new Model[4];
            this.nodeLinks = new Model[BattleField.MaxCities];

            string fileName = "linkarrow.mesh";
            {
                FileLocation fl2 = FileSystem.Instance.Locate(fileName, GameFileLocs.Model);
                ResourceHandle<ModelData> mdlData = ModelManager.Instance.CreateInstance(rs, fl2);
                for (int i = 0; i < linkArrow.Length; i++)
                {
                    linkArrow[i] = new Model(mdlData);                    
                }
                for (int i = 0; i < nodeLinks.Length; i++)
                {
                    nodeLinks[i] = new Model(mdlData);                    
                }
            }
            FileLocation fl = FileSystem.Instance.Locate("citysel_inner.mesh", GameFileLocs.Model);
            inner_marker = new Model(ModelManager.Instance.CreateInstance(rs, fl));

            fl = FileSystem.Instance.Locate("citysel_outter.mesh", GameFileLocs.Model);
            outter_marker = new Model(ModelManager.Instance.CreateInstance(rs, fl));

            BoundingSphere.Radius = float.MaxValue;
            Transformation = Matrix.Identity;
        }
Example #20
0
        public void CreateResourceBall(Player owner, City city, RBallType type)
        {
            RBall ball = new RBall(owner, city, type);
            resBalls.Add(ball);

            if (ResourceBallChanged != null) 
            {
                ResourceBallChanged(this, new ResourceBallEventArg(true, ball));
            }
        }
Example #21
0
 protected WorldDynamicObject(Player owner) 
 {
     this.Owner = owner;
     //fsmMachine = new FSMMachine(this);
     //this.IsSelected = false;
 }
Example #22
0
        public InGameUI(Code2015 game, Game parent, GameScene scene, GameState gamelogic)
        {
            this.parent = parent;
            this.logic = gamelogic;

            this.game = game;
            this.renderSys = game.RenderSystem;
            this.scene = scene;
        

            this.player = parent.HumanPlayer;


            picker = new Picker(game, parent, scene, gamelogic);
            AddElement(picker);


            //this.infoUI = new InfoUI(game, parent, scene, gamelogic);
            //AddElement(infoUI);

          
            this.miniMap = new MiniMap(game, parent, scene, gamelogic);
            AddElement(miniMap);
         

            //-----Ruan-----------


            cityStatusInfo = new CitySelectInfo(game, parent, scene, gamelogic);
            AddElement(cityStatusInfo);

            objectStatusInfo = new ObjectSelectInfo(game, parent, scene, gamelogic);
            AddElement(objectStatusInfo);

            sendBallSelect = new RBallTypeSelect(game, parent, scene, gamelogic);
            AddElement(sendBallSelect);



            nigMenu = new NIGMenu(game, parent, scene, gamelogic);
            AddElement(nigMenu);
            nigColor = new NIGColor(game, parent, scene, gamelogic);
            AddElement(nigColor);
            nigWin = new NIGWin(game, parent, scene, gamelogic);
            AddElement(nigWin);
            nigFail = new NIGFail(game, parent, scene, gamelogic);
            AddElement(nigFail);
            nigObjective = new NIGObjective(game, parent, scene, gamelogic);
            AddElement(nigObjective);
            nigColor = new NIGColor(game, parent, scene, gamelogic);
            AddElement(nigColor);

            rankInfo = new RankInfo(game, parent, scene, gamelogic);
            AddElement(rankInfo);

            selectionMarker = new SelectionMarker(renderSys, gamelogic.Field, player);
            scene.Scene.AddObjectToScene(selectionMarker);


            layeredCursor = new Cursor(game, parent, scene, gamelogic, picker, cityStatusInfo, objectStatusInfo,
                                           sendBallSelect,  miniMap, selectionMarker, rankInfo);
            AddElement(layeredCursor);


            exit = new ExitGame(game, parent, scene, gamelogic, nigMenu);
            AddElement(exit);

            quest = new Quest(game, parent, scene, gamelogic);
            AddElement(quest);

            
        }
Example #23
0
        public RBallTypeSelect(Code2015 game, Game parent, GameScene scene, GameState logic)
        {
            this.game = game;
            this.parent = parent;
            this.scene = scene;
            this.gameLogic = logic;
            this.player = parent.HumanPlayer;
            this.renderSys = game.RenderSystem;

            FileLocation fl = FileSystem.Instance.Locate("nig_icon_green.tex", GameFileLocs.GUI);
            greenBallBtn = UITextureManager.Instance.CreateInstance(fl);


            fl = FileSystem.Instance.Locate("nig_icon_edu.tex", GameFileLocs.GUI);
            educationBallBtn = UITextureManager.Instance.CreateInstance(fl);


            fl = FileSystem.Instance.Locate("nig_icon_hospital.tex", GameFileLocs.GUI);
            healthBallBtn = UITextureManager.Instance.CreateInstance(fl);



            fl = FileSystem.Instance.Locate("nig_send_ball.tex", GameFileLocs.GUI);
            background = UITextureManager.Instance.CreateInstance(fl);

            backgroundSelected = new Texture[3];
            fl = FileSystem.Instance.Locate("nig_send_ball_s1.tex", GameFileLocs.GUI);
            backgroundSelected[0] = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("nig_send_ball_s2.tex", GameFileLocs.GUI);
            backgroundSelected[1] = UITextureManager.Instance.CreateInstance(fl);
            fl = FileSystem.Instance.Locate("nig_send_ball_s3.tex", GameFileLocs.GUI);
            backgroundSelected[2] = UITextureManager.Instance.CreateInstance(fl);


            f8 = GameFontManager.Instance.FRuanEdged8;

            resBallsCount[0].Type = RBallType.Green;
            resBallsCount[0].count = 0;

            resBallsCount[1].Type = RBallType.Education;
            resBallsCount[1].count = 0;

            resBallsCount[2].Type = RBallType.Health;
            resBallsCount[2].count = 0;


        }
Example #24
0
 public void Damage(float v, Player owener)
 {
     healthValue -= v * RulesTable.CityArmor;
     if (healthValue < 0)
     {
         healthValue = CurrentMaxHealth;
         ChangeOwner(owener);
     }
 }