コード例 #1
0
ファイル: AlienOne.cs プロジェクト: justshiv/LightSavers
        public override void Construct(Vector3 spawnPosition, float rotation, CampaignSection section)
        {
            base.Construct(spawnPosition, rotation, section);

            this._state = AlienState.ALIVE;
            this._livestate = LiveState.ROAMING;
            this._health = 90;

            this._mesh = new SkinnedMesh();
            this._mesh.Model = AssetLoader.mdl_alien1;

            this._aplayer = new DurationBasedAnimator(_mesh.SkinningData, _mesh.SkinningData.AnimationClips["Take 001"], null);

            this._aplayer.AddAnimationPackage = AssetLoader.ani_alien1;
            this._aplayer.StartClip(Animation_States.moving);

            this.VerticalOffset = new Vector3(0, 0.8f, 0);
            this.ScaleMatrix = Matrix.CreateScale(0.6f);

            UpdateAnimations(0);
            UpdateMajorTransform();

            Globals.gameInstance.sceneGraph.Setup(_mesh);
            this._modelReceipt = Globals.gameInstance.sceneGraph.Add(_mesh);

            _collisionRectangle = new RectangleF(
                _position.X - bBWidth,
                _position.Z - bBWidth, bBWidth * 2, bBWidth * 2);
        }
コード例 #2
0
ファイル: BaseAlien.cs プロジェクト: justshiv/LightSavers
 public virtual void Construct(Vector3 spawnPosition, float rotation, CampaignSection section)
 {
     this._mustBeDeleted = false;
     this._position = spawnPosition;
     this._rotation = rotation;
     this._section = section;
 }
コード例 #3
0
ファイル: AlienOne.cs プロジェクト: justshiv/LightSavers
 public AlienOne(Vector3 spawnPosition, CampaignSection section)
 {
     Construct(spawnPosition, (float)Globals.random.NextDouble() * MathHelper.TwoPi, section);
 }
コード例 #4
0
 public void AddSection(CampaignSection csection)
 {
     sections.Add(csection);
 }
コード例 #5
0
 public void AddSection(CampaignSection csection)
 {
     sections.Add(csection);
 }
コード例 #6
0
ファイル: WorldBuilder.cs プロジェクト: justshiv/LightSavers
        public static void SpawnEntities(int id, Vector3 corigin, int index)
        {
            CampaignSection csection = new CampaignSection(index, corigin);

            Texture2D t = AssetLoader.tex_section_ent[id];
            Color[] colours = new Color[96*96];
            t.GetData<Color>(colours);

            for (int y = 0; y < 32; y++)
            {
                for (int x = 0; x < 32; x++)
                {
                    int pixelX = x * 3;
                    int pixelY = y * 3;
                    int pixelIndex = pixelY * 96 + pixelX;


                    Color c = colours[pixelIndex];
                    Vector3 center = corigin + new Vector3(0.5f + x, 0, 0.5f + y);


                    if (c == Color.Black || c == Color.Blue)
                    {
                        Globals.gameInstance.cellCollider.SetCollision(center.X, center.Z, true);
                    }
                    else if (c == Color.Yellow)
                    {
                        csection.AddOverheadLight(SpawnOverheadLight(center));
                    }
                    else if (c == Color.Red)
                    {
                        SpawnFilingCabinet(center, colours, pixelX, pixelY);
                    }
                    else if (c == PureGreen)
                    {
                        int pi2 = (pixelY+1) * 96 + pixelX+1;

                        Color cc = colours[pi2];
                        if (cc == PureGreen)
                        {
                            csection.SetDoor(new Door(center));
                        }
                    }
                    else if (c == Color.DarkMagenta)
                    {
                        int pi2 = (pixelY + 2) * 96 + pixelX + 1;

                        if (colours[pi2] != Color.DarkMagenta)
                        {
                            Mesh m = new Mesh();
                            m.Model = AssetLoader.mdl_desk;
                            m.SetInstancingEnabled(true);
                            m.Transform = Matrix.CreateRotationY(MathHelper.ToRadians(0)) * Matrix.CreateTranslation(center + new Vector3(0,0,0.5f));

                            Globals.gameInstance.cellCollider.SetCollision(center.X, center.Z, true);
                            Globals.gameInstance.cellCollider.SetCollision(center.X, center.Z + 1, true);

                            Globals.gameInstance.sceneGraph.Setup(m);
                            Globals.gameInstance.sceneGraph.Add(m);
                        }

                        int pi3 = (pixelY + 1) * 96 + pixelX + 2;

                        if (colours[pi3] != Color.DarkMagenta)
                        {
                            Mesh m = new Mesh();
                            m.Model = AssetLoader.mdl_desk;
                            m.SetInstancingEnabled(true);
                            m.Transform = Matrix.CreateRotationY(MathHelper.ToRadians(90)) * Matrix.CreateTranslation(center + new Vector3(0.5f, 0, 0));

                            Globals.gameInstance.cellCollider.SetCollision(center.X, center.Z, true);
                            Globals.gameInstance.cellCollider.SetCollision(center.X, center.Z + 1, true);

                            Globals.gameInstance.sceneGraph.Setup(m);
                            Globals.gameInstance.sceneGraph.Add(m);
                        }

                    }
                    else if (c == Color.Turquoise)
                    {
                        float a = GetAngleToAWall(colours, pixelX, pixelY);
                        Mesh m = new Mesh();
                        m.Model = AssetLoader.mdl_pipe;
                        m.SetInstancingEnabled(true);
                        m.Transform = Matrix.CreateRotationY(MathHelper.ToRadians(a)) * Matrix.CreateTranslation(center);

                        Globals.gameInstance.cellCollider.SetCollision(center.X, center.Z, true);

                        Globals.gameInstance.sceneGraph.Setup(m);
                        Globals.gameInstance.sceneGraph.Add(m);

                    }
                    else if (c == Color.Tan)
                    {
                        csection.SetWeaponDepot(new WeaponDepot(center, Globals.random.Next(3)+1));
                    }
                    else if (c == Color.SteelBlue)
                    {
                        Globals.gameInstance.campaignManager.SetTeleport(new Teleporter(center));
                    }

                }
            }

            Globals.gameInstance.campaignManager.AddSection(csection);
        }