예제 #1
0
파일: Enemy.cs 프로젝트: JamesHetfield/LD27
        public virtual void Die()
        {
            for (int x = 0; x < spriteSheet.X_SIZE; x++)
            {
                for (int y = 0; y < spriteSheet.Y_SIZE; y++)
                {
                    for (int z = 0; z < spriteSheet.Z_SIZE; z++)
                    {
                        if (Helper.Random.Next(5) == 1)
                        {
                            SpriteVoxel v = spriteSheet.AnimChunks[CurrentFrame].Voxels[x, y, z];
                            if (!v.Active)
                            {
                                continue;
                            }
                            Vector3 pos = (-new Vector3(spriteSheet.X_SIZE * Voxel.HALF_SIZE, spriteSheet.Y_SIZE * Voxel.HALF_SIZE, spriteSheet.Z_SIZE * Voxel.HALF_SIZE) * Scale) + (new Vector3(x * Voxel.SIZE, y * Voxel.SIZE, z * Voxel.SIZE) * Scale);
                            pos = Position + Vector3.Transform(pos, Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ(Rotation));
                            ParticleController.Instance.Spawn(pos, -(Vector3.One * 0.1f) + (Vector3.One * ((float)Helper.Random.NextDouble() * 0.2f)), 0.3f, v.Color, 3000, true);
                        }
                    }
                }
            }

            Active = false;
        }
예제 #2
0
파일: Hero.cs 프로젝트: JamesHetfield/LD27
        public virtual void Die()
        {
            if (Dead || !introTargetReached)
            {
                return;
            }

            for (int x = 0; x < spriteSheet.X_SIZE; x++)
            {
                for (int y = 0; y < spriteSheet.Y_SIZE; y++)
                {
                    for (int z = 0; z < spriteSheet.Z_SIZE; z++)
                    {
                        if (Helper.Random.Next(5) == 1)
                        {
                            SpriteVoxel v = spriteSheet.AnimChunks[currentFrame].Voxels[x, y, z];
                            Vector3     pos;
                            if (!v.Active)
                            {
                                pos = (-new Vector3(spriteSheet.X_SIZE * Voxel.HALF_SIZE, spriteSheet.Y_SIZE * Voxel.HALF_SIZE, spriteSheet.Z_SIZE * Voxel.HALF_SIZE) * 0.9f) + (new Vector3(x * Voxel.SIZE, y * Voxel.SIZE, z * Voxel.SIZE) * 0.9f);
                                pos = Position + new Vector3(0f, 0f, -7f) + Vector3.Transform(pos, Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ(Rotation));
                                ParticleController.Instance.Spawn(pos, -(Vector3.One * 0.1f) + (Vector3.One * ((float)Helper.Random.NextDouble() * 0.2f)), 0.3f, v.Color, 3000, true);
                            }

                            v = spriteSheet.AnimChunks[currentFrame + 4].Voxels[x, y, z];
                            if (!v.Active)
                            {
                                continue;
                            }
                            pos = (-new Vector3(spriteSheet.X_SIZE * Voxel.HALF_SIZE, spriteSheet.Y_SIZE * Voxel.HALF_SIZE, spriteSheet.Z_SIZE * Voxel.HALF_SIZE) * 0.9f) + (new Vector3(x * Voxel.SIZE, y * Voxel.SIZE, z * Voxel.SIZE) * 0.9f);
                            pos = Position + new Vector3(0f, 0f, -7f) + Vector3.Transform(pos, Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationZ(Rotation));
                            ParticleController.Instance.Spawn(pos, -(Vector3.One * 0.1f) + (Vector3.One * ((float)Helper.Random.NextDouble() * 0.2f)), 0.3f, v.Color, 3000, true);
                        }
                    }
                }
            }

            for (int i = 0; i < 16; i++)
            {
                ParticleController.Instance.Spawn(Position + new Vector3(0f, 0f, -7f), new Vector3(-0.05f + ((float)Helper.Random.NextDouble() * 0.1f), -0.05f + ((float)Helper.Random.NextDouble() * 0.1f), -0.05f + ((float)Helper.Random.NextDouble() * 0.1f)), 0.5f, new Color(0.5f + ((float)Helper.Random.NextDouble() * 0.5f), 0f, 0f), 1000, true);
            }

            Dead = true;
        }