コード例 #1
0
 protected override void OnPrepare(GameState prev, object[] parms)
 {
     this._rnd   = new Random();
     this._crits = new GameObjectSet(this.App);
     this._sky   = new Sky(this.App, SkyUsage.InSystem, 0);
     this._crits.Add((IGameObject)this._sky);
     this._camera = this._crits.Add <OrbitCameraController>();
     this._input  = this._crits.Add <CombatInput>();
     this._grid   = this._crits.Add <CombatGrid>();
 }
コード例 #2
0
ファイル: Combat.cs プロジェクト: zerk-js/SOTSII-SOS
        public static Combat Create(
            App game,
            OrbitCameraController cameraController,
            CombatInput input,
            CombatSensor sensor,
            StarSystem system,
            CombatGrid grid,
            Vector3 origin,
            float radius,
            int duration,
            Player[] players,
            Dictionary <Player, Dictionary <Player, PlayerCombatDiplomacy> > diplomacyStates,
            bool simulateOnly = false)
        {
            List <int>    list       = ((IEnumerable <Player>)players).Where <Player>((Func <Player, bool>)(x => !x.IsStandardPlayer)).Select <Player, int>((Func <Player, int>)(x => x.ObjectID)).ToList <int>();
            Combat        combat     = new Combat();
            List <object> objectList = new List <object>();

            objectList.Add((object)cameraController.GetObjectID());
            objectList.Add((object)input.GetObjectID());
            objectList.Add((object)sensor.GetObjectID());
            objectList.Add((object)system.GetObjectID());
            objectList.Add((object)grid.GetObjectID());
            objectList.Add((object)origin);
            objectList.Add((object)radius);
            objectList.Add((object)duration);
            objectList.Add((object)game.LocalPlayer.GetObjectID());
            objectList.Add((object)simulateOnly);
            objectList.Add((object)players.Length);
            foreach (Player player in players)
            {
                objectList.Add((object)player.ObjectID);
            }
            objectList.Add((object)diplomacyStates.Count);
            foreach (KeyValuePair <Player, Dictionary <Player, PlayerCombatDiplomacy> > diplomacyState in diplomacyStates)
            {
                objectList.Add((object)diplomacyState.Key.GetObjectID());
                objectList.Add((object)diplomacyState.Value.Count);
                foreach (KeyValuePair <Player, PlayerCombatDiplomacy> keyValuePair in diplomacyState.Value)
                {
                    objectList.Add((object)keyValuePair.Key.GetObjectID());
                    objectList.Add((object)keyValuePair.Value);
                }
            }
            objectList.Add((object)list.Count);
            foreach (int num in list)
            {
                objectList.Add((object)num);
            }
            game.AddExistingObject((IGameObject)combat, objectList.ToArray());
            return(combat);
        }
コード例 #3
0
 protected override void OnPrepare(GameState prev, object[] parms)
 {
     this._crits = new GameObjectSet(this.App);
     this._crits.Add((IGameObject) new Sky(this.App, SkyUsage.InSystem, 0));
     this._camera = this._crits.Add <OrbitCameraController>();
     this._camera.DesiredDistance   = 30f;
     this._combatGrid               = this._crits.Add <CombatGrid>();
     this._combatGrid.GridSize      = 5000f;
     this._combatGrid.CellSize      = 500f;
     this._combatInput              = this._crits.Add <CombatInput>();
     this._combatInput.CameraID     = this._camera.ObjectID;
     this._combatInput.CombatGridID = this._combatGrid.ObjectID;
     this._bigbad           = this._crits.Add <StaticModel>((object)"\\base\\factions\\zuul\\models\\Suul'ka\\suulka_test.scene");
     this._litmus1          = this._crits.Add <StaticModel>((object)"\\base\\props\\litmus_01.scene");
     this._litmus2          = this._crits.Add <StaticModel>((object)"\\base\\props\\litmus_02.scene");
     this._litmus3          = this._crits.Add <StaticModel>((object)"\\base\\props\\litmus_03.scene");
     this._bigbad.Position  = new Vector3(0.0f, -800f, 0.0f);
     this._litmus1.Position = new Vector3(-300f, 0.0f, 0.0f);
     this._litmus2.Position = new Vector3(0.0f, 0.0f, 0.0f);
     this._litmus3.Position = new Vector3(300f, 0.0f, 0.0f);
 }
コード例 #4
0
        protected override void OnPrepare(GameState prev, object[] parms)
        {
            this.App.NewGame();
            this._crits  = new GameObjectSet(this.App);
            this._sky    = new Sky(this.App, SkyUsage.InSystem, 0);
            this._camera = this._crits.Add <OrbitCameraController>();
            this._camera.TargetPosition = new Vector3(0.0f, 0.0f, 0.0f);
            this._combatInput           = this._crits.Add <CombatInput>();
            this._combatGrid            = this._crits.Add <CombatGrid>();
            CreateShipParams createShipParams = new CreateShipParams();

            createShipParams.player   = this.App.LocalPlayer;
            createShipParams.sections = this.App.AssetDatabase.ShipSections.Where <ShipSectionAsset>((Func <ShipSectionAsset, bool>)(x =>
            {
                if (!(x.Faction == "morrigi") || x.Class != ShipClass.Cruiser)
                {
                    return(false);
                }
                if (!x.FileName.Contains("cr_cmd.section") && !x.FileName.Contains("cr_eng_fusion.section"))
                {
                    return(x.FileName.Contains("cr_mis_armor.section"));
                }
                return(true);
            }));
            createShipParams.turretHousings   = this.App.AssetDatabase.TurretHousings;
            createShipParams.weapons          = this.App.AssetDatabase.Weapons;
            createShipParams.preferredWeapons = this.App.AssetDatabase.Weapons;
            createShipParams.modules          = this.App.AssetDatabase.Modules;
            createShipParams.preferredModules = this.App.AssetDatabase.Modules;
            createShipParams.psionics         = this.App.AssetDatabase.Psionics;
            createShipParams.faction          = this.App.AssetDatabase.GetFaction("morrigi");
            createShipParams.shipName         = "BOOGER";
            createShipParams.inputID          = this._combatInput.ObjectID;
            this._ship = Ship.CreateShip(this.App, createShipParams);
            this._crits.Add((IGameObject)this._ship);
            this._ship2          = Ship.CreateShip(this.App, createShipParams);
            this._ship2.Position = new Vector3(1000f, 0.0f, 0.0f);
            this._crits.Add((IGameObject)this._ship2);
        }