コード例 #1
0
        public Data Create(Row row)
        {
            Data data;

            switch (Index)
            {
            case 1:
            {
                data = new Achievements(row, this);
                break;
            }

            case 2:
            {
                data = new Alliance_badges(row, this);
                break;
            }

            case 3:
            {
                data = new Alliance_portal(row, this);
                break;
            }

            case 4:
            {
                data = new Billing_packages(row, this);
                break;
            }

            case 5:
            {
                data = new Building_classes(row, this);
                break;
            }

            case 6:
            {
                data = new Buildings(row, this);
                break;
            }

            case 7:
            {
                data = new Characters(row, this);
                break;
            }

            case 8:
            {
                data = new Decos(row, this);
                break;
            }

            case 9:
            {
                data = new Effects(row, this);
                break;
            }

            case 10:
            {
                data = new Experience_levels(row, this);
                break;
            }

            case 11:
            {
                data = new Faq(row, this);
                break;
            }

            case 12:
            {
                data = new Globals(row, this);
                break;
            }

            case 13:
            {
                data = new Heroes(row, this);
                break;
            }

            case 14:
            {
                data = new Hints(row, this);
                break;
            }

            case 15:
            {
                data = new Leagues(row, this);
                break;
            }

            case 16:
            {
                data = new Locales(row, this);
                break;
            }

            case 17:
            {
                data = new Missions(row, this);
                break;
            }

            case 18:
            {
                data = new News(row, this);
                break;
            }

            case 19:
            {
                data = new Npcs(row, this);
                break;
            }

            case 20:
            {
                data = new Obstacles(row, this);
                break;
            }

            case 21:
            {
                data = new Particle_emitters(row, this);
                break;
            }

            case 22:
            {
                data = new Projectiles(row, this);
                break;
            }

            case 23:
            {
                data = new Resource_packs(row, this);
                break;
            }

            case 24:
            {
                data = new Logic.Resources(row, this);
                break;
            }

            case 25:
            {
                data = new Shields(row, this);
                break;
            }

            case 26:
            {
                data = new Spells(row, this);
                break;
            }

            case 27:
            {
                data = new Texts(row, this);
                break;
            }

            case 28:
            {
                data = new Traps(row, this);
                break;
            }

            default:
            {
                data = new Data(row, this);
                break;
            }
            }

            return(data);
        }
コード例 #2
0
ファイル: Tile.cs プロジェクト: S4slean/TONO
 public virtual void SetProjectileOnTile(Projectiles projectiles)
 {
     projectileOnTile = projectiles;
 }
コード例 #3
0
 public void addParticle(Particle part)
 {
     Projectiles.Add(part);
 }
コード例 #4
0
 public void AddProjectile(Projectile proj)
 {
     Projectiles.Add(proj);
 }
コード例 #5
0
        internal void PurgeAll()
        {
            FutureEvents.Purge((int)Tick);
            PurgeTerminalSystem();

            foreach (var item in _effectedCubes)
            {
                var cubeid     = item.Key;
                var blockInfo  = item.Value;
                var functBlock = blockInfo.FunctBlock;
                var cube       = blockInfo.CubeBlock;

                if (cube == null || cube.MarkedForClose)
                {
                    _effectPurge.Enqueue(cubeid);
                    continue;
                }

                functBlock.EnabledChanged -= ForceDisable;
                functBlock.Enabled         = blockInfo.FirstState;
                cube.SetDamageEffect(false);
                _effectPurge.Enqueue(cubeid);
            }

            while (_effectPurge.Count != 0)
            {
                _effectedCubes.Remove(_effectPurge.Dequeue());
            }

            Av.Glows.Clear();
            Av.AvShotPool.Clean();

            DeferedUpBlockTypeCleanUp(true);

            foreach (var map in GridToFatMap.Keys)
            {
                RemoveGridFromMap(map);
            }

            GridToFatMap.Clear();
            FatMapPool.Clean();

            DirtyGridsTmp.Clear();

            foreach (var structure in WeaponPlatforms.Values)
            {
                foreach (var system in structure.WeaponSystems)
                {
                    foreach (var ammo in system.Value.WeaponAmmoTypes)
                    {
                        ammo.AmmoDef.Const.PrimeEntityPool?.Clean();
                    }
                }

                structure.WeaponSystems.Clear();
            }
            WeaponPlatforms.Clear();

            foreach (var gridToMap in GridToBlockTypeMap)
            {
                foreach (var map in gridToMap.Value)
                {
                    map.Value.ClearImmediate();
                    ConcurrentListPool.Return(map.Value);
                }
                gridToMap.Value.Clear();
                BlockTypePool.Return(gridToMap.Value);
            }
            GridToBlockTypeMap.Clear();

            foreach (var playerGrids in PlayerEntityIdInRange)
            {
                playerGrids.Value.Clear();
            }

            PlayerEntityIdInRange.Clear();

            DirtyGrids.Clear();

            DsUtil.Purge();
            DsUtil2.Purge();

            _effectActive = false;
            ShootingWeapons.Clear();
            AcquireTargets.Clear();
            RemoveEffectsFromGrid.Clear();
            WeaponAmmoPullQueue.Clear();
            AmmoToPullQueue.Clear();
            Hits.Clear();
            AllArmorBaseDefinitions.Clear();
            HeavyArmorBaseDefinitions.Clear();
            AllArmorBaseDefinitions.Clear();
            AcquireTargets.Clear();
            ChargingWeapons.Clear();
            LargeBlockSphereDb.Clear();
            SmallBlockSphereDb.Clear();
            AnimationsToProcess.Clear();
            _subTypeIdToWeaponDefs.Clear();
            WeaponDefinitions.Clear();
            _slimsSortedList.Clear();
            _destroyedSlims.Clear();
            _destroyedSlimsClient.Clear();
            _slimHealthClient.Clear();
            _slimsSet.Clear();
            _turretDefinitions.Clear();

            CompsToStart.ClearImmediate();

            CompsDelayed.Clear();
            CompReAdds.Clear();
            GridAiPool.Clean();

            foreach (var av in Av.AvShots)
            {
                av.HitEffect?.Stop();
                av.GlowSteps.Clear();
                Av.AvShotPool.Return(av);
            }
            Av.AvShotPool.Clean();

            GridEffectPool.Clean();
            GridEffectsPool.Clean();
            BlockTypePool.Clean();
            ConcurrentListPool.Clean();

            GroupInfoPool.Clean();
            TargetInfoPool.Clean();

            Projectiles.Clean();
            WeaponCoreBlockDefs.Clear();
            VanillaIds.Clear();
            VanillaCoreIds.Clear();
            WeaponCoreFixedBlockDefs.Clear();
            WeaponCoreTurretBlockDefs.Clear();

            foreach (var p in Projectiles.ProjectilePool)
            {
                p.AmmoEffect?.Stop();
            }

            Projectiles.CheckPool.Clean();
            Projectiles.ShrapnelToSpawn.Clear();
            Projectiles.ShrapnelPool.Clean();
            Projectiles.FragmentPool.Clean();
            Projectiles.CheckPool.Clean();
            Projectiles.ActiveProjetiles.ApplyChanges();
            Projectiles.ActiveProjetiles.Clear();
            Projectiles.ProjectilePool.Clear();
            Projectiles.HitEntityPool.Clean();
            Projectiles.CleanUp.Clear();
            Projectiles.VirtInfoPool.Clean();
            Projectiles.V3Pool.Clean();

            DbsToUpdate.Clear();
            GridTargetingAIs.Clear();

            Projectiles = null;
            TrackingAi  = null;
            UiInput     = null;
            TargetUi    = null;
            Placer      = null;
            WheelUi     = null;
            TargetGps   = null;
            SApi.Unload();
            SApi      = null;
            Api       = null;
            ApiServer = null;

            WeaponDefinitions   = null;
            AnimationsToProcess = null;
            ProjectileTree.Clear();
            ProjectileTree = null;

            AllDefinitions   = null;
            SoundDefinitions = null;
            ActiveCockPit    = null;
            ControlledEntity = null;
        }
コード例 #6
0
ファイル: SessionRun.cs プロジェクト: keleios/WeaponCore
        public override void Simulate()
        {
            try
            {
                if (SupressLoad)
                {
                    return;
                }

                if (!DedicatedServer)
                {
                    EntityControlUpdate();
                    CameraMatrix = Session.Camera.WorldMatrix;
                    CameraPos    = CameraMatrix.Translation;
                    PlayerPos    = Session.Player?.Character?.WorldAABB.Center ?? Vector3D.Zero;
                }

                if (GameLoaded)
                {
                    DsUtil.Start("ai");
                    AiLoop();
                    DsUtil.Complete("ai", true);


                    DsUtil.Start("charge");
                    if (ChargingWeapons.Count > 0)
                    {
                        UpdateChargeWeapons();
                    }
                    DsUtil.Complete("charge", true);

                    DsUtil.Start("acquire");
                    if (AcquireTargets.Count > 0)
                    {
                        CheckAcquire();
                    }
                    DsUtil.Complete("acquire", true);

                    DsUtil.Start("shoot");
                    if (ShootingWeapons.Count > 0)
                    {
                        ShootWeapons();
                    }
                    DsUtil.Complete("shoot", true);
                }

                if (!DedicatedServer && !InMenu)
                {
                    UpdateLocalAiAndCockpit();
                    if (UiInput.PlayerCamera && ActiveCockPit != null || ActiveControlBlock is MyRemoteControl && !UiInput.PlayerCamera)
                    {
                        TargetSelection();
                    }
                }

                DsUtil.Start("ps");
                Projectiles.SpawnAndMove();
                DsUtil.Complete("ps", true);

                DsUtil.Start("pi");
                Projectiles.Intersect();
                DsUtil.Complete("pi", true);

                DsUtil.Start("pd");
                Projectiles.Damage();
                DsUtil.Complete("pd", true);

                DsUtil.Start("pa");
                Projectiles.AvUpdate();
                DsUtil.Complete("pa", true);

                DsUtil.Start("av");
                if (!DedicatedServer)
                {
                    Av.End();
                }
                DsUtil.Complete("av", true);

                if (MpActive)
                {
                    DsUtil.Start("network1");
                    if (PacketsToClient.Count > 0 || PrunedPacketsToClient.Count > 0)
                    {
                        ProccessServerPacketsForClients();
                    }
                    if (PacketsToServer.Count > 0)
                    {
                        ProccessClientPacketsForServer();
                    }

                    DsUtil.Complete("network1", true);
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionSim: {ex}"); }
        }
コード例 #7
0
 void Start()
 {
     gameManager = GameObject.Find ("GameManager");
     projectiles = gameManager.GetComponent<Projectiles>();
 }
コード例 #8
0
ファイル: Level.cs プロジェクト: eric1338/ThesisCode
        public void AddProjectileByPosition(Vector2 projectilePosition)
        {
            Projectiles.Add(new Projectile(currentProjectileID, projectilePosition));

            currentProjectileID++;
        }
コード例 #9
0
    void CreateProjectile(Projectiles projectileType, GameObject projectile)
    {
        switch (projectileType)
        {
        case Projectiles.PISTOL:
            projectile.transform.position = transform.position;
            projectile.GetComponent <Particle2D>().CreateParticle2D(2.0f, 0.99f, 10.0f, transform.right, projGravity, true);
            projectile.GetComponent <Particle2D>().setShouldIgnoreForces(false);

            BuoyancyForceGenerator buoyancy = new BuoyancyForceGenerator(projectile, projectile.transform.localScale.y / 2.0f, 1.0f, WaterObject.waterTopPos.y, 80.0f);
            ForceManager.instance.AddForceGen(buoyancy);

            projectile.GetComponent <Particle2D>().setParticleInstantiated(true);
            Debug.Log(currentProjectileType);
            break;

        case Projectiles.SPRINGSHOT:
            projectile.transform.position = transform.position;
            GameObject secondShot = Instantiate(projectile);
            Vector3    newPos     = new Vector3(0.0f, 2.0f, 0.0f);
            secondShot.transform.position = newPos;

            projectile.GetComponent <Particle2D>().CreateParticle2D(2.0f, 0.99f, 10.0f, transform.right, projGravity, true);
            secondShot.GetComponent <Particle2D>().CreateParticle2D(2.0f, 0.99f, 25.0f, transform.right, projGravity, true);
            projectile.GetComponent <Particle2D>().setShouldIgnoreForces(false);
            secondShot.GetComponent <Particle2D>().setShouldIgnoreForces(false);

            SpringForceGenerator springGen = new SpringForceGenerator(projectile, secondShot, 2.0f, 0.5f);
            ForceManager.instance.AddForceGen(springGen);

            BuoyancyForceGenerator springBuoy1 = new BuoyancyForceGenerator(projectile, projectile.transform.localScale.y / 2.0f, 1.0f, WaterObject.waterTopPos.y, 80.0f);
            ForceManager.instance.AddForceGen(springBuoy1);

            BuoyancyForceGenerator springBuoy2 = new BuoyancyForceGenerator(projectile, projectile.transform.localScale.y / 2.0f, 1.0f, WaterObject.waterTopPos.y, 80.0f);
            ForceManager.instance.AddForceGen(springBuoy2);

            projectile.GetComponent <Particle2D>().setParticleInstantiated(true);
            secondShot.GetComponent <Particle2D>().setParticleInstantiated(true);

            Debug.Log(currentProjectileType);
            break;

        case Projectiles.RODSHOT:
            projectile.transform.position = transform.position;
            GameObject connectedShot = Instantiate(projectile);
            Vector3    changePos     = new Vector3(0.0f, 2.0f, 0.0f);
            connectedShot.transform.position = changePos;
            projectile.GetComponent <Particle2D>().CreateParticle2D(2.0f, 0.99f, 10.0f, transform.right, projGravity, true);
            connectedShot.GetComponent <Particle2D>().CreateParticle2D(2.0f, 0.99f, 25.0f, transform.right, projGravity, true);
            projectile.GetComponent <Particle2D>().setShouldIgnoreForces(false);
            connectedShot.GetComponent <Particle2D>().setShouldIgnoreForces(false);

            ParticleRod newRod = new ParticleRod();
            newRod.InstantiateVariables(projectile.GetComponent <Particle2D>(), connectedShot.GetComponent <Particle2D>(), 10.0f);
            particleLinks.Add(newRod);

            BuoyancyForceGenerator rodBuoy1 = new BuoyancyForceGenerator(projectile, projectile.transform.localScale.y / 2.0f, 1.0f, WaterObject.waterTopPos.y, 80.0f);
            ForceManager.instance.AddForceGen(rodBuoy1);

            BuoyancyForceGenerator rodBuoy2 = new BuoyancyForceGenerator(projectile, projectile.transform.localScale.y / 2.0f, 1.0f, WaterObject.waterTopPos.y, 80.0f);
            ForceManager.instance.AddForceGen(rodBuoy2);

            projectile.GetComponent <Particle2D>().setParticleInstantiated(true);
            connectedShot.GetComponent <Particle2D>().setParticleInstantiated(true);
            Debug.Log(currentProjectileType);
            break;
        }
    }
コード例 #10
0
 public virtual void LeaveWorld(Entity entity)
 {
     if (!(entity is Pet || entity is Portal))
     {
         if (entity is Wall && entity.ObjectDesc != null && entity.ObjectDesc.FullOccupy || entity.ObjectDesc.OccupySquare || entity.ObjectDesc.EnemyOccupySquare)
         {
             WmapTile tile = Map[(int)entity.X, (int)entity.Y].Clone();
             tile.TileId     = Map[(int)entity.X, (int)entity.Y].TileId;
             tile.ObjType    = 0;
             tile.ObjectDesc = null;
             Map[(int)entity.X, (int)entity.Y] = tile;
         }
     }
     if (entity is Player)
     {
         Player dummy;
         if (!Players.TryRemove(entity.Id, out dummy))
         {
             Console.WriteLine("Could not remove {0} from world {1}", entity.Name, Name);
         }
         PlayersCollision.Remove(entity);
     }
     else if (entity is Enemy)
     {
         Enemy dummy;
         Enemies.TryRemove(entity.Id, out dummy);
         EnemiesCollision.Remove(entity);
         if (entity.ObjectDesc.Quest)
         {
             Quests.TryRemove(entity.Id, out dummy);
         }
     }
     else
     {
         var projectile = entity as Projectile;
         if (projectile != null)
         {
             var p = projectile;
             Projectiles.TryRemove(new Tuple <int, byte>(p.ProjectileOwner.Self.Id, p.ProjectileId), out p);
         }
         else if (entity is StaticObject)
         {
             StaticObject dummy;
             StaticObjects.TryRemove(entity.Id, out dummy);
             if (entity is Decoy)
             {
                 PlayersCollision.Remove(entity);
             }
             else
             {
                 EnemiesCollision.Remove(entity);
             }
         }
         else if (entity is Pet)
         {
             if (entity.IsPet)
             {
                 Pet dummy2;
                 Pets.TryRemove(entity.Id, out dummy2);
                 PlayersCollision.Remove(entity);
             }
         }
     }
     entity.Owner = null;
     entity.Dispose();
 }
コード例 #11
0
        private void UseAttack()
        {
            const double velocityScalar = 1.5;

            Projectiles.Add(new Fireball(Location, GenerateFireballVector(velocityScalar, 0), true));
        }
コード例 #12
0
 internal void RemoveProjectile(Projectile projectile)
 {
     Projectiles.Remove(projectile);
     DrawNodeUsers.Remove(projectile);
     RemoveChild(projectile);
 }
コード例 #13
0
 internal void AddProjectile(Projectile projectile)
 {
     Projectiles.Add(projectile);
     DrawNodeUsers.Add(projectile);
     AddChild(projectile);
 }
コード例 #14
0
 void Start()
 {
     projectiles = FindObjectOfType <Projectiles>();
 }
コード例 #15
0
 /// <summary>
 /// Removes a specified projectile from the list of projectiles
 /// </summary>
 /// <param name="ID"> ID of the specified projectile to be removed </param>
 public void ProjectileRemove(int ID)
 {
     Projectiles.Remove(ID);
 }
コード例 #16
0
 public static void Register()
 {
     Projectiles.RegisterProjectiles();
     Items.RegisterItems();
     Enemies.RegisterEnemies();
 }
コード例 #17
0
        public virtual void LeaveWorld(Entity entity)
        {
            if (entity is Player)
            {
                Player dummy;
                Players.TryRemove(entity.Id, out dummy);
                PlayersCollision.Remove(entity);

                // if in trade, cancel it...
                if (dummy.tradeTarget != null)
                {
                    dummy.CancelTrade();
                }

                if (dummy.Pet != null)
                {
                    LeaveWorld(dummy.Pet);
                }
            }
            else if (entity is Enemy)
            {
                Enemy dummy;
                Enemies.TryRemove(entity.Id, out dummy);
                EnemiesCollision.Remove(entity);
                if (entity.ObjectDesc.Quest)
                {
                    Quests.TryRemove(entity.Id, out dummy);
                }
            }
            else if (entity is Projectile)
            {
                var p = entity as Projectile;
                Projectiles.TryRemove(new Tuple <int, byte>(p.ProjectileOwner.Self.Id, p.ProjectileId), out p);
            }
            else if (entity is StaticObject)
            {
                StaticObject dummy;
                StaticObjects.TryRemove(entity.Id, out dummy);

                if (entity.ObjectDesc?.BlocksSight == true)
                {
                    if (Blocking == 3)
                    {
                        Sight.UpdateRegion(Map, (int)entity.X, (int)entity.Y);
                    }

                    foreach (var plr in Players.Values
                             .Where(p => MathsUtils.DistSqr(p.X, p.Y, entity.X, entity.Y) < Player.RadiusSqr))
                    {
                        plr.Sight.UpdateCount++;
                    }
                }

                if (entity is Decoy)
                {
                    PlayersCollision.Remove(entity);
                }
                else
                {
                    EnemiesCollision.Remove(entity);
                }
            }
            else if (entity is Pet)
            {
                Pet dummy;
                Pets.TryRemove(entity.Id, out dummy);
                PlayersCollision.Remove(entity);
            }

            entity.Dispose();
        }
コード例 #18
0
        public override Pool <ProjectileData> .Node FireProjectile(Vector2 direction, float leakedTime)
        {
            Pool <ProjectileData> .Node node = new Pool <ProjectileData> .Node();

            Direction = direction;
            RefreshGroups();

            if (!AutoFire)
            {
                if (Interval > 0)
                {
                    return(node);
                }
                else
                {
                    Interval = CoolOffTime;
                }
            }

            for (int g = 0; g < GroupCount; g++)
            {
                if (Projectiles.AvailableCount >= SpokeCount)
                {
                    float rotation = 0;
                    bool  left     = true;

                    for (int n = 0; n < SpokeCount; n++)
                    {
                        node = Projectiles.Get();

                        node.Item.Position   = transform.position;
                        node.Item.Speed      = Speed;
                        node.Item.Scale      = Scale;
                        node.Item.TimeToLive = TimeToLive;
                        node.Item.Gravity    = Gravity;
                        if (UseFollowTarget && FollowTargetType == FollowTargetType.LockOnShot && Target != null)
                        {
                            Groups[g].Direction = (Target.transform.position - transform.position).normalized;
                        }
                        node.Item.Color           = Color.Evaluate(0);
                        node.Item.Acceleration    = Acceleration;
                        node.Item.FollowTarget    = UseFollowTarget;
                        node.Item.FollowIntensity = FollowIntensity;
                        node.Item.Target          = Target;

                        if (left)
                        {
                            node.Item.Velocity = Speed * Rotate(Groups[g].Direction, rotation).normalized;
                            rotation          += SpokeSpacing;
                        }
                        else
                        {
                            node.Item.Velocity = Speed * Rotate(Groups[g].Direction, -rotation).normalized;
                        }

                        // Setup outline if we have one
                        if (ProjectilePrefab.Outline != null && DrawOutlines)
                        {
                            Pool <ProjectileData> .Node outlineNode = ProjectileOutlines.Get();

                            outlineNode.Item.Position = node.Item.Position;
                            outlineNode.Item.Scale    = node.Item.Scale + OutlineSize;
                            outlineNode.Item.Color    = OutlineColor.Evaluate(0);

                            node.Item.Outline = outlineNode;
                        }

                        // Keep track of active projectiles
                        PreviousActiveProjectileIndexes[ActiveProjectileIndexesPosition] = node.NodeIndex;
                        ActiveProjectileIndexesPosition++;
                        if (ActiveProjectileIndexesPosition < ActiveProjectileIndexes.Length)
                        {
                            PreviousActiveProjectileIndexes[ActiveProjectileIndexesPosition] = -1;
                        }
                        else
                        {
                            Debug.Log("Error: Projectile was fired before list of active projectiles was refreshed.");
                        }

                        UpdateProjectile(ref node, leakedTime);

                        left = !left;
                    }

                    if (Groups[g].InvertRotation)
                    {
                        Groups[g].Direction = Rotate(Groups[g].Direction, -RotationSpeed);
                    }
                    else
                    {
                        Groups[g].Direction = Rotate(Groups[g].Direction, RotationSpeed);
                    }
                }
            }

            return(node);
        }
コード例 #19
0
ファイル: Rules.cs プロジェクト: VladisS-Vostok2000/Game
 internal Projectile GetProjectile(string projectileName) => (Projectile)Projectiles.First((projectile) => projectile.Name == projectileName).Clone();
コード例 #20
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            #region Adding base texture to Sprite

            Texture2D baseTex = new Texture2D(GraphicsDevice, 2, 2);
            Color[]   c       = new Color[4];
            c[0] = Color.White;
            c[1] = Color.White;
            c[2] = Color.White;
            c[3] = Color.White;
            baseTex.SetData(c);
            Texture2DPlus baseTexPlus = new Texture2DPlus(baseTex);
            Sprite.addBaseTexture(baseTexPlus);
            #endregion

            #region Loading fonts

            DrawHelper.DEBUGFONT   = Content.Load <SpriteFont>("fonts/debugfont");
            DrawHelper.SCOREFONT   = Content.Load <SpriteFont>("fonts/ScoreFont");
            DrawHelper.BIGFONT     = Content.Load <SpriteFont>("fonts/BigScoreFont");
            DrawHelper.UPGRADEFONT = Content.Load <SpriteFont>("fonts/currencyFont");
            #endregion

            #region Loading textures

            Texture2DPlus backgroundTex = new Texture2DPlus(Content.Load <Texture2D>("background/Background"));
            Texture2DPlus bluePlanetTex = new Texture2DPlus(Content.Load <Texture2D>("background/BluePlanet"));
            Texture2DPlus smallRedTex   = new Texture2DPlus(Content.Load <Texture2D>("background/LittleRedPlanet"));
            Texture2DPlus bigRedTex     = new Texture2DPlus(Content.Load <Texture2D>("background/RedBigPlanet"));
            Texture2DPlus cursorTex     = new Texture2DPlus(Content.Load <Texture2D>("textures/cursor"));

            Texture2DPlus errorTex             = new Texture2DPlus(Content.Load <Texture2D>("textures/noTexture"));
            Texture2DPlus enemyTex1            = new Texture2DPlus(Content.Load <Texture2D>("textures/enemyShip"), 2);
            Texture2DPlus enemyTex2            = new Texture2DPlus(Content.Load <Texture2D>("textures/enemyShoot"), 2);
            Texture2DPlus enemyTex3            = new Texture2DPlus(Content.Load <Texture2D>("textures/enemySpeed"), 2);
            Texture2DPlus enemyTex4            = new Texture2DPlus(Content.Load <Texture2D>("textures/asteroid"));
            Texture2DPlus shipTex              = new Texture2DPlus(Content.Load <Texture2D>("parts/Hull_3"));
            Texture2DPlus wallTex              = new Texture2DPlus(Content.Load <Texture2D>("textures/wall"));
            Texture2DPlus shotTex              = new Texture2DPlus(Content.Load <Texture2D>("textures/lazor"), 4);
            Texture2DPlus sprayBulletTex       = new Texture2DPlus(Content.Load <Texture2D>("textures/SprayBullet"), 2);
            Texture2DPlus mineBulletTex        = new Texture2DPlus(Content.Load <Texture2D>("textures/mineBullet_1"), 9);
            Texture2DPlus chargingBulletTex    = new Texture2DPlus(Content.Load <Texture2D>("textures/ChargingBullet"), 6);
            Texture2DPlus gravityBulletTex     = new Texture2DPlus(Content.Load <Texture2D>("textures/GravityBullet"), 6);
            Texture2DPlus homingTex            = new Texture2DPlus(Content.Load <Texture2D>("textures/homing"));
            Texture2DPlus healthDropTex        = new Texture2DPlus(Content.Load <Texture2D>("textures/healthPack"), 4);
            Texture2DPlus moneyDropTex         = new Texture2DPlus(Content.Load <Texture2D>("textures/MoneyDrop"), 7);
            Texture2DPlus healthDrop_TIER2_Tex = new Texture2DPlus(Content.Load <Texture2D>("textures/healthDrop_TIER2"), 4);
            Texture2DPlus wrenchTex            = new Texture2DPlus(Content.Load <Texture2D>("textures/wrench"));
            Texture2DPlus explosionDropTex     = new Texture2DPlus(Content.Load <Texture2D>("textures/explosionDrop"), 8);
            Texture2DPlus boltTex              = new Texture2DPlus(Content.Load <Texture2D>("textures/bolt"));
            Texture2DPlus moneyTex             = new Texture2DPlus(Content.Load <Texture2D>("textures/money"));
            Texture2DPlus energyDropTex        = new Texture2DPlus(Content.Load <Texture2D>("textures/energyDrop"), 8);
            Texture2DPlus unitBarBorderTex     = new Texture2DPlus(Content.Load <Texture2D>("textures/unitBarBorder"));
            Texture2DPlus gunTex1              = new Texture2DPlus(Content.Load <Texture2D>("parts/Gun_1"));
            Texture2DPlus mineGunTex           = new Texture2DPlus(Content.Load <Texture2D>("parts/MineGun"));
            Texture2DPlus sprayGunTex          = new Texture2DPlus(Content.Load <Texture2D>("parts/SprayGun"));
            Texture2DPlus chargingGunTex       = new Texture2DPlus(Content.Load <Texture2D>("parts/ChargingGun"));
            Texture2DPlus gravityGunTex        = new Texture2DPlus(Content.Load <Texture2D>("parts/GravityGun"));
            Texture2DPlus engineTex1           = new Texture2DPlus(Content.Load <Texture2D>("parts/Engine_1"));
            Texture2DPlus selectionBoxTex      = new Texture2DPlus(Content.Load <Texture2D>("parts/SelectionBox"));
            Texture2DPlus upgradeBkg           = new Texture2DPlus(Content.Load <Texture2D>("parts/UpgradeBarBkg"));
            Texture2DPlus popupTextBkgTex      = new Texture2DPlus(Content.Load <Texture2D>("textures/PopupTextBkg"));
            Texture2DPlus menuScreenBkg        = new Texture2DPlus(Content.Load <Texture2D>("parts/MenuScreenBkg"));
            Texture2DPlus rotateItemTex        = new Texture2DPlus(Content.Load <Texture2D>("textures/Rotate"));
            Texture2DPlus hammerItemTex        = new Texture2DPlus(Content.Load <Texture2D>("textures/Hammer"));
            Texture2DPlus alertTex             = new Texture2DPlus(Content.Load <Texture2D>("textures/AlertParticle"));
            Texture2DPlus logoTex              = new Texture2DPlus(Content.Load <Texture2D>("textures/logo"));

            //allUpgradeParts.Insert(PartTypes.DETECTORPART, shotTex);
            #endregion

            #region Loading sounds and adding them to list
            SoundHandler.Sounds[(int)IDs.DEFAULT]             = Content.Load <SoundEffect>("sounds/shotSnd");
            SoundHandler.Sounds[(int)IDs.GUNPART]             = Content.Load <SoundEffect>("sounds/shotSnd");
            SoundHandler.Sounds[(int)IDs.GRAVITYBULLET]       = Content.Load <SoundEffect>("sounds/blackholeSnd");
            SoundHandler.Sounds[(int)IDs.MENUCLICK]           = Content.Load <SoundEffect>("sounds/menuclickSnd");
            SoundHandler.Sounds[(int)IDs.CHARGINGGUNPART]     = Content.Load <SoundEffect>("sounds/chargeshotSnd");
            SoundHandler.Sounds[(int)IDs.EXPLOSIONDEATHSOUND] = Content.Load <SoundEffect>("sounds/ExplosionDeath");
            SoundHandler.Sounds[(int)IDs.PLAYERDEATHSOUND]    = Content.Load <SoundEffect>("sounds/player_death");
            SoundHandler.Sounds[(int)IDs.SLOWMOSOUND]         = Content.Load <SoundEffect>("sounds/slomo");
            SoundHandler.Sounds[(int)IDs.REVERSESLOWMOSOUND]  = Content.Load <SoundEffect>("sounds/reverse_slomo");
            SoundHandler.Sounds[(int)IDs.PICKUPSOUND]         = Content.Load <SoundEffect>("sounds/pickup");
            SoundHandler.Songs[(int)IDs.SONG1INTRO]           = Content.Load <SoundEffect>("sounds/OdysseanIntro");
            SoundHandler.Songs[(int)IDs.SONG1]    = Content.Load <SoundEffect>("sounds/Odyssean");
            SoundHandler.Songs[(int)IDs.SONG2]    = Content.Load <SoundEffect>("sounds/Galaxian");
            SoundHandler.Songs[(int)IDs.VICTORY]  = Content.Load <SoundEffect>("sounds/Victorian");
            SoundHandler.Songs[(int)IDs.GAMEOVER] = Content.Load <SoundEffect>("sounds/GameOver");
            //Console.WriteLine(SoundHandler.Songs[(int)IDs.SONG1INTRO].Duration);
            #endregion
            //Directory.GetFiles(Directory.GetCurrentDirectory() + "\\Content\\textures");

            #region Adding sprites to list
            SpriteHandler.Sprites[(int)IDs.DEFAULT] = new Sprite(errorTex);
            //SpriteHandler.Sprites[(int)IDs.DEFAULT_ENEMY] = new Sprite(enemyTex1, 2, 4);
            //SpriteHandler.Sprites[(int)IDs.ENEMYSHOOT] = new Sprite(enemyTex2, 2, 4);
            //SpriteHandler.Sprites[(int)IDs.ENEMYSPEED] = new Sprite(enemyTex3, 2, 4);
            SpriteHandler.Sprites[(int)IDs.ENEMYASTER]       = new Sprite(enemyTex4);
            SpriteHandler.Sprites[(int)IDs.DEFAULT_BULLET]   = new Sprite(shotTex, 4);
            SpriteHandler.Sprites[(int)IDs.CHARGINGBULLET]   = new Sprite(chargingBulletTex, 24);
            SpriteHandler.Sprites[(int)IDs.GRAVITYBULLET]    = new Sprite(gravityBulletTex, 24);
            SpriteHandler.Sprites[(int)IDs.SPRAYBULLET]      = new Sprite(sprayBulletTex, 2);
            SpriteHandler.Sprites[(int)IDs.HOMINGBULLET]     = new Sprite(homingTex);
            SpriteHandler.Sprites[(int)IDs.HEALTHDROP]       = new Sprite(healthDropTex, 6);
            SpriteHandler.Sprites[(int)IDs.HEALTHDROP_TIER2] = new Sprite(healthDrop_TIER2_Tex, 6);
            SpriteHandler.Sprites[(int)IDs.EXPLOSIONDROP]    = new Sprite(explosionDropTex, 6);
            SpriteHandler.Sprites[(int)IDs.ENERGYDROP]       = new Sprite(energyDropTex, 6);
            SpriteHandler.Sprites[(int)IDs.MINEBULLET]       = new Sprite(mineBulletTex, 6);
            SpriteHandler.Sprites[(int)IDs.RECTHULLPART]     = new Sprite(shipTex);
            SpriteHandler.Sprites[(int)IDs.GUNPART]          = new Sprite(gunTex1);
            SpriteHandler.Sprites[(int)IDs.MINEGUNPART]      = new Sprite(mineGunTex);
            SpriteHandler.Sprites[(int)IDs.GRAVITYGUNPART]   = new Sprite(gravityGunTex);
            SpriteHandler.Sprites[(int)IDs.CHARGINGGUNPART]  = new Sprite(chargingGunTex);
            SpriteHandler.Sprites[(int)IDs.SPRAYGUNPART]     = new Sprite(sprayGunTex);
            SpriteHandler.Sprites[(int)IDs.ENGINEPART]       = new Sprite(engineTex1);
            SpriteHandler.Sprites[(int)IDs.DEFAULT_PARTICLE] = new Sprite();
            SpriteHandler.Sprites[(int)IDs.WALL]             = new Sprite(wallTex);
            SpriteHandler.Sprites[(int)IDs.WRENCH]           = new Sprite(wrenchTex);
            SpriteHandler.Sprites[(int)IDs.BOLT]             = new Sprite(boltTex);
            SpriteHandler.Sprites[(int)IDs.EMPTYPART]        = new Sprite(selectionBoxTex);
            SpriteHandler.Sprites[(int)IDs.UPGRADEBAR]       = new Sprite(upgradeBkg);
            SpriteHandler.Sprites[(int)IDs.POPUPTEXTBKG]     = new Sprite(popupTextBkgTex);
            SpriteHandler.Sprites[(int)IDs.MENUSCREENBKG]    = new Sprite(menuScreenBkg);
            SpriteHandler.Sprites[(int)IDs.MONEYDROP]        = new Sprite(moneyDropTex, 6);
            SpriteHandler.Sprites[(int)IDs.MONEY]            = new Sprite(moneyTex);
            SpriteHandler.Sprites[(int)IDs.ROTATEPART]       = new Sprite(rotateItemTex);
            SpriteHandler.Sprites[(int)IDs.HAMMERPART]       = new Sprite(hammerItemTex);
            SpriteHandler.Sprites[(int)IDs.ALERTPARTICLE]    = new Sprite(alertTex);
            SpriteHandler.Sprites[(int)IDs.LOGO]             = new Sprite(logoTex);
            #endregion

            #region Adding partIDs to list
            List <IDs> ids = new List <IDs>();
            for (int i = (int)IDs.DEFAULT_PART + 1; i <= (int)IDs.EMPTYPART; i++)
            {
                ids.Add((IDs)i);
            }
            ids.Add(IDs.ROTATEPART); //!!
            #endregion

            #region Initializing game objects etc.
            background = new Background(new Sprite(backgroundTex), bluePlanetTex, bluePlanetTex, bigRedTex, smallRedTex);
            //Camera.Player = player; //Reintroduce if camera is to be used
            AchievementController achController = new AchievementController();
            SaveHandler.InitializeGame(achController);
            GameMode    gameMode    = new GameMode();
            Projectiles projectiles = new Projectiles();
            GunPart.projectiles = projectiles;

            Player player = new Player(new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2), projectiles); //ok, projectiles null before?
            eventOperator = new EventOperator(this, shipTex, gameMode, achController, player, ids);
            RectangularHull rectHull1 = new RectangularHull();
            RectangularHull rectHull2 = new RectangularHull();
            GunPart         gunPart1  = new ChargingGunPart();
            GunPart         gunPart2  = new ChargingGunPart();
            GunPart         gunPart3  = new GunPart(IDs.DEFAULT);
            EnginePart      engine1   = new EnginePart();
            EnginePart      engine2   = new EnginePart();
            EnginePart      engine3   = new EnginePart();
            Drops           drops     = new Drops(WindowSize.Width, WindowSize.Height);
            gameController = new GameController(player, projectiles, drops, gameMode);
            //wall = new Wall(new Vector2(-4000, -4000)); //! wall location
            UnitBar healthBar = new UnitBar(new Vector2(50, 50), new Sprite(unitBarBorderTex), Color.OrangeRed, 5); //! LOL
            UnitBar energyBar = new UnitBar(new Vector2(50, 85), new Sprite(unitBarBorderTex), Color.Gold, player.maxEnergy);
            playerUI = new PlayerUI(healthBar, energyBar, achController);
            Mouse.SetCursor(MouseCursor.FromTexture2D(cursorTex.Texture, cursorTex.Texture.Width / 2, cursorTex.Texture.Height / 2));
            #endregion

            // TODO: use this.Content to load your game content here
        }
コード例 #21
0
        public bool ProjectileCollidesDoor(Projectiles.BaseBullet b)
        {

            // top door
            if (b.position.X > currentSection * 32 + 31f) return true;
            return false;
        }
コード例 #22
0
        //public double MinimumDistance
        //{
        //    get { return Connector.MinimumDistance; }
        //    set { Connector.MinimumDistance = value; }
        //}

        public int GetIndex(Projectile projectile)
        {
            return(Projectiles.IndexOf(projectile));
        }