Ejemplo n.º 1
0
        public VictimLeaf(  MegaTile ParentMegaTile,
                            Animation GroundAnimation, 
                            Animation StumpAnimation, 
                            Animation ExplodeAnimation, 
                            Animation TornadoAnimation,
                            string SoundFileName,
                            Vector2 Position)
        {
            this.megatile = ParentMegaTile;
            this.GroundAnimation = GroundAnimation;
            this.StumpAnimation = StumpAnimation;
            this.ExplodeAnimation = ExplodeAnimation;
            this.TornadoAnimation = TornadoAnimation;

            this.soundHit = SoundFileName;

            GroundHealth = 0;
            TornadoHealth = 0;

            Mass = 0.1f;

            bounds = new Rectangle2D(Position.X, Position.Y, TornadoAnimation.FrameWidth, TornadoAnimation.FrameHeight);

            state = State.Flying;

            PreLoadSounds();
        }
Ejemplo n.º 2
0
        public VictimUFO(MegaTile ParentMegaTile, Animation GroundAnimation, Animation StumpAnimation, Animation ExplodeAnimation, Animation TornadoAnimation, string SoundFileName, Level ParentLevel )
        {
            this.megatile = ParentMegaTile;
            this.GroundAnimation = GroundAnimation;
            this.StumpAnimation = StumpAnimation;
            this.ExplodeAnimation = ExplodeAnimation;
            this.TornadoAnimation = TornadoAnimation;
            this.level = ParentLevel;

            removeFromMegaTileOnDeath = true;

            this.soundHit = SoundFileName;
            state = State.Ground;

            if (GroundAnimation.FrameWidth > GroundAnimation.FrameHeight)
            {
                squareDimensions = GroundAnimation.FrameWidth;
            }
            else
            {
                squareDimensions = GroundAnimation.FrameHeight;
            }

            squareDimensions *= 16;

            PreLoadSounds();

            PlaceInWorld();
        }
Ejemplo n.º 3
0
 public VictimBoss(MegaTile ParentMegaTile,
                     Animation GroundAnimation,
                     Animation StumpAnimation,
                     Animation ExplodeAnimation,
                     Animation TornadoAnimation,
                     string SoundFileName,
                     Vector2 Position)
     : base(ParentMegaTile,GroundAnimation,StumpAnimation,ExplodeAnimation,TornadoAnimation,SoundFileName,Position)
 {
 }
Ejemplo n.º 4
0
        public VictimSkyscraper(MegaTile ParentMegaTile,
                            Animation GroundAnimation,
                            Animation StumpAnimation,
                            Animation ExplodeAnimation,
                            Animation TornadoAnimation,
                            string SoundFileName,
                            Vector2 Position)
        {
            this.megatile = ParentMegaTile;
            this.GroundAnimation = GroundAnimation;
            this.StumpAnimation = StumpAnimation;
            this.ExplodeAnimation = ExplodeAnimation;
            this.TornadoAnimation = TornadoAnimation;

            this.soundHit = SoundFileName;

            removeFromMegaTileOnDeath = false;

            bounds = new Rectangle2D(Position.X, Position.Y, GroundAnimation.FrameWidth, GroundAnimation.FrameHeight);

            state = State.Ground;

            PreLoadSounds();
        }
Ejemplo n.º 5
0
        public static Victim CreateVictimOfClass(VictimConfig vicConfig, Vector2 position, MegaTile megaTile, Level level)
        {
            Victim returnVictim = null;

            switch (vicConfig.VictimClass)
            {
                case VictimClass.BASE:
                    returnVictim = new VictimBase(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position);
                    break;
                case VictimClass.CAR:
                    returnVictim = new VictimCar(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position);
                    break;
                case VictimClass.HOUSE:
                    returnVictim = new VictimHouse(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position);
                    break;
                case VictimClass.SKYSCRAPER:
                    returnVictim = new VictimSkyscraper(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position);
                    break;
                case VictimClass.BOSS:
                    returnVictim = new VictimBoss(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position);
                    break;
                case VictimClass.MAN:
                    returnVictim = new VictimMan(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position);
                    break;
                case VictimClass.PLANE:
                    if (level == null)
                    {
                        throw new Exception("Level cannot be null for construction of a plane");
                    }
                    returnVictim = new VictimPlane(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, level);
                    break;
                case VictimClass.UFO:
                    if (level == null)
                    {
                        throw new Exception("Level cannot be null for construction of a UFO");
                    }
                    returnVictim = new VictimUFO(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(),
                            vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, level);
                    break;
                default:
                    throw new ApplicationException("Attempted to create a victim of a class that doesn't exist!");
                    break;
            }

            //Set other properties for victims
            returnVictim.Mass= vicConfig.Mass;
            returnVictim.GroundHealth = vicConfig.GroundHealth;
            returnVictim.TornadoHealth = vicConfig.TorontoHealth;
            returnVictim.speed = vicConfig.VictimSpeed;
            Victim.CurrentVicitimID = Victim.CurrentVicitimID + 1;
            returnVictim.VictimID = Victim.CurrentVicitimID;

            return returnVictim;
        }
Ejemplo n.º 6
0
 public static Victim CreateVictimOfClass(VictimConfig vicConfig, Vector2 position, MegaTile megaTile)
 {
     return CreateVictimOfClass(vicConfig, position, megaTile, null);
 }
Ejemplo n.º 7
0
        //Set the neighbours of this tile
        public void SetNeighbours(MegaTile westTile, MegaTile eastTile, MegaTile northTile, MegaTile southTile)
        {
            //Store a reference to all neighbours
            WestMegaTile = westTile;
            EastMegaTile = eastTile;
            NorthMegaTile = northTile;
            SouthMegaTile = southTile;

            //Figure out if this mega tile should draw roads because of neighbours
            if (!megaTileType.CanHaveRoads)
            {
                //Check if a road should be drawn to the west
                if (WestMegaTile != null && WestMegaTile.MegaTileType.CanHaveRoads)
                {
                    westRoad = true;
                }
                //Check if a road should be drawn to the north
                if (NorthMegaTile != null && NorthMegaTile.MegaTileType.CanHaveRoads)
                {
                    northRoad = true;
                }

                //Place a 4way intersection texture if both roads are present
                if (westRoad && northRoad)
                {
                    intersection = true;
                }
            }

            //Place a 4-way texture if tiles above and left both have roads
            //if (!WestRoad && !NorthRoad)
            //{
                if ((WestMegaTile != null && WestMegaTile.NorthRoad) || (NorthMegaTile != null && NorthMegaTile.WestRoad))
                {
                    intersection = true;
                }
            //}
        }