Ejemplo n.º 1
0
 public override bool DoAction(GameObject o)
 {
     if (this.phase == 0)
     {
         if (!o.IsOnGround)
         {
             return true;
         }
         this.phase = 1;
         this.jumpSpot = (int) o.Location.X;
         this.jump.Reset();
     }
     else if (this.phase == 1)
     {
         if (!this.jump.DoAction(o))
         {
             return false;
         }
         if (((o.CurrentDirection != Direction.Right) || (o.Location.X <= (this.jumpSpot + 2))) && ((o.CurrentDirection != Direction.Left) || (o.Location.X >= (this.jumpSpot - 2))))
         {
             new Reverse().DoAction(o);
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
        public void HandleHit(GameObject colObject)
        {
            if ((this.timeRemaining != 0) && !this.singleMove)
            {
                this.timeRemaining = 0;
                GameEngine.Framework.PlaySound(this.collectSound);
                if (this.item != null)
                {
                    if (this.item.State == EquipItemState.NotFound)
                    {
                        this.item.State = EquipItemState.NotEquipped;
                    }
                }
                else
                {
                    switch (this.thisObject.Type)
                    {
                        case ObjectType.Coin:
                        case ObjectType.MoneyBag:
                            GameEngine.Game.GetPlayerStats().GiveGold(this.itemValue);
                            return;

                        case ObjectType.Heart:
                            GameEngine.Game.GetPlayerStats().Heal(this.itemValue);
                            return;

                        case ObjectType.LargeHeart:
                            GameEngine.Game.CurrentMap.HeartRefill();
                            return;

                        case ObjectType.ExtraHeart:
                            GameEngine.Game.GetPlayerStats().AddHeartContainer();
                            return;

                        case ObjectType.ItemPickup:
                            GameEngine.Game.GiveItem((ObjectType) this.itemValue);
                            return;

                        case ObjectType.Key:
                        {
                            PlayerStatus playerStats = GameEngine.Game.GetPlayerStats();
                            playerStats.Keys++;
                            return;
                        }
                        case ObjectType.Medicine:
                            return;

                        case ObjectType.Stone:
                        {
                            PlayerStatus status1 = GameEngine.Game.GetPlayerStats();
                            status1.Stones++;
                            return;
                        }
                        case ObjectType.MysteryBlock:
                            GameEngine.Game.CurrentMap.RevealDoor(true);
                            return;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public override bool DoAction(GameObject o)
 {
     if (this.stopImmediate)
     {
         if (this.stopX)
         {
             o.XSpeed.SetSpeed((float) 0f);
         }
         if (this.stopY)
         {
             o.YSpeed.SetSpeed((float) 0f);
         }
     }
     else
     {
         if (this.stopX)
         {
             o.XSpeed.TargetSpeed = 0f;
         }
         if (this.stopY)
         {
             o.YSpeed.TargetSpeed = 0f;
         }
     }
     return true;
 }
Ejemplo n.º 4
0
 public override bool DoAction(GameObject o)
 {
     if (this.duration == -1)
     {
         this.duration = Utility.RandomInt(60, 180);
     }
     if (o.Location.X < this.leftBound)
     {
         this.movingLeft = true;
         this.timer.Timer = 0;
     }
     else if (o.Location.X > this.rightBound)
     {
         this.movingLeft = false;
         this.timer.Timer = 0;
     }
     if (this.timer.Update())
     {
         if (this.movingLeft && (o.X < this.midBound))
         {
             this.movingLeft = false;
             this.moveRightAct.DoAction(o);
         }
         else if (o.X > this.midBound)
         {
             this.movingLeft = true;
             this.moveLeftAct.DoAction(o);
         }
         this.timer.Max = Utility.RandomInt(30, 180);
     }
     this.duration--;
     return (this.duration == 0);
 }
Ejemplo n.º 5
0
 public override bool DoAction(GameObject o)
 {
     if (!this.moved)
     {
         this.moved = true;
         int xStrength = 0;
         if (o.XSpeed.CurrentSpeed > 0f)
         {
             xStrength = this.xStrength;
         }
         else if (o.XSpeed.CurrentSpeed < 0f)
         {
             xStrength = -1 * this.xStrength;
         }
         else if (o.XSpeed.CurrentSpeed == 0f)
         {
             if (o.CurrentDirection == Direction.Right)
             {
                 xStrength = this.xStrength;
             }
             else if (o.CurrentDirection == Direction.Left)
             {
                 xStrength = -1 * this.xStrength;
             }
         }
         o.XSpeed.CurrentSpeed = xStrength;
         o.YSpeed.CurrentSpeed = this.yStrength;
         o.XSpeed.Acceleration = this.acceleration;
         o.YSpeed.Acceleration = this.acceleration;
         o.XSpeed.TargetSpeed = 0f;
         o.YSpeed.TargetSpeed = 0f;
     }
     return ((o.XSpeed.CurrentSpeed == 0f) && (o.YSpeed.CurrentSpeed == 0f));
 }
Ejemplo n.º 6
0
 public EnemyBehavior(GameObject p_object, int p_hitPoints, int delay, ActivationTypes p_activationType, FacePlayerBehavior p_fpBehavior)
 {
     this.hitPoints = 5;
     this.awakenDistance = 300;
     this.attackDistance = 60;
     this.ignoreHitFloor = true;
     this.Init(p_object, p_hitPoints, delay, p_activationType, p_fpBehavior);
 }
Ejemplo n.º 7
0
 public override bool DoAction(GameObject o)
 {
     if (o.CurrentAnimation != this.animation)
     {
         o.CurrentAnimation = this.animation;
     }
     return true;
 }
Ejemplo n.º 8
0
 public BulletBehavior(GameObject p_object, int p_duration, bool p_destroyOnHitbackground, bool p_unblockable)
 {
     this.unblockable = p_unblockable;
     this.destroyOnHitBackground = p_destroyOnHitbackground;
     this.duration = p_duration;
     this.thisObject = p_object;
     this.motion = new List<GameAction>();
 }
Ejemplo n.º 9
0
 public override bool DoAction(GameObject o)
 {
     if ((this.chance <= 0) || (Utility.RandomInt(0, 100) <= this.chance))
     {
         int targetSpeed = 0;
         if ((o.CurrentDirection == Direction.Left) || (o.CurrentDirection == Direction.Right))
         {
             targetSpeed = (int) o.XSpeed.TargetSpeed;
             if (targetSpeed != 0)
             {
                 if (!this.changeDirection)
                 {
                     o.XSpeed.SetSpeed((float) (-1 * targetSpeed));
                 }
                 else if (o.CurrentDirection == Direction.Left)
                 {
                     o.CurrentDirection = Direction.Right;
                     o.XSpeed.SetSpeed((float) Math.Abs(targetSpeed));
                 }
                 else
                 {
                     o.CurrentDirection = Direction.Left;
                     o.XSpeed.SetSpeed((float) (-1 * Math.Abs(targetSpeed)));
                 }
             }
         }
         else if ((o.CurrentDirection == Direction.Up) || (o.CurrentDirection == Direction.Down))
         {
             targetSpeed = (int) o.YSpeed.TargetSpeed;
             if (targetSpeed != 0)
             {
                 if (o.CurrentDirection == Direction.Left)
                 {
                     o.CurrentDirection = Direction.Right;
                     o.YSpeed.SetSpeed((float) Math.Abs(targetSpeed));
                 }
                 else if (o.CurrentDirection == Direction.Right)
                 {
                     o.CurrentDirection = Direction.Left;
                     o.YSpeed.SetSpeed((float) (-1 * Math.Abs(targetSpeed)));
                 }
                 else if (o.CurrentDirection == Direction.Up)
                 {
                     o.CurrentDirection = Direction.Down;
                     o.YSpeed.SetSpeed((float) Math.Abs(targetSpeed));
                 }
                 else
                 {
                     o.CurrentDirection = Direction.Up;
                     o.YSpeed.SetSpeed((float) (-1 * Math.Abs(targetSpeed)));
                 }
             }
         }
     }
     return true;
 }
Ejemplo n.º 10
0
 public override bool DoAction(GameObject o)
 {
     if (!this.hasMoved)
     {
         this.hasMoved = true;
         o.XSpeed.SetSpeed(this.xSpeed, o.CurrentDirection);
         o.YSpeed.SetSpeed(this.ySpeed);
     }
     return ((o.XSpeed.CurrentSpeed == o.XSpeed.TargetSpeed) && (o.YSpeed.CurrentSpeed == o.YSpeed.TargetSpeed));
 }
Ejemplo n.º 11
0
 public override bool DoAction(GameObject o)
 {
     if (!this.played && this.playStopped)
     {
         o.CurrentAnimation = AnimType.Stopped;
         this.played = true;
     }
     this.timeLeft--;
     return (this.timeLeft <= 0);
 }
Ejemplo n.º 12
0
 public TornadoBehavior(GameObject p_object, GameObject p_player)
 {
     this.thisObject = p_object;
     if (p_player.CurrentDirection == Direction.Right)
     {
         this.thisObject.XSpeed.SetSpeed((float) this.speed);
     }
     else
     {
         this.thisObject.XSpeed.SetSpeed((float) (-1 * this.speed));
     }
     this.thisObject.YSpeed.CurrentSpeed = -4f;
 }
Ejemplo n.º 13
0
 public override bool DoAction(GameObject o)
 {
     GameObject player = GameEngine.Game.GetPlayer();
     if (o.Location.X < player.Location.X)
     {
         o.CurrentDirection = Direction.Right;
     }
     else
     {
         o.CurrentDirection = Direction.Left;
     }
     return true;
 }
Ejemplo n.º 14
0
        public PlayerBehavior(GameObject p_object, ObjectType t)
        {
            this.lavaDamageTimer.Timer = -1;
            this.thisObject = p_object;
            this.currentPhysics = Physics.None;
            try
            {
                if (GameEngine.Game.GetPlayerStats().IsUnderwater)
                {
                    this.SetPhysics(Physics.InWater);
                }
                else
                {
                    this.SetPhysics(Physics.Normal);
                }
            }
            catch
            {
                this.SetPhysics(Physics.Normal);
            }
            switch (t)
            {
                case ObjectType.Fox:
                    this.canDuck = true;
                    return;

                case ObjectType.Human:
                    this.canDuck = true;
                    return;

                case ObjectType.Lizard:
                    this.canDuck = true;
                    return;

                case ObjectType.Mouse:
                    this.canDuck = false;
                    return;

                case ObjectType.Piranha:
                    this.canDuck = false;
                    return;

                case ObjectType.Tiger:
                    this.canDuck = false;
                    return;

                case ObjectType.Hawk:
                    this.canDuck = false;
                    return;
            }
        }
Ejemplo n.º 15
0
 public BoomerangBehavior(GameObject p_object, GameObject p_player)
 {
     this.thisObject = p_object;
     if (p_player.CurrentDirection == Direction.Right)
     {
         this.thisObject.XSpeed.CurrentSpeed = this.speed;
     }
     else
     {
         this.thisObject.XSpeed.CurrentSpeed = -1 * this.speed;
     }
     this.thisObject.XSpeed.TargetSpeed = -1f * this.thisObject.XSpeed.CurrentSpeed;
     this.thisObject.XSpeed.Acceleration = 0.5f;
 }
Ejemplo n.º 16
0
 public DaiymoDragonMotion()
 {
     this.sword.DefineAnimation(AnimType.Stopped, new Animation(Point.Empty, Size.Empty));
     this.sword.GetAnimation(AnimType.Stopped).HitboxSize = new SizeF(16f, 48f);
     this.sword.GetAnimation(AnimType.Stopped).SecondaryCollisionRectangle = new RectangleF(-8f, -64f, 16f, 16f);
     this.sword.AttackDamage = ObjectFactory.GetEnemyDamage(7, 2);
     this.sword.SetBehavior(new BlankBehavior());
     this.sword.Visible = false;
     this.swordSpark = new GameObject(new GameTexture("lightning.bmp", new Size(0x10, 0x10), TextureDisposePolicy.DisposeOnTileChange), ObjectType.SwordSpark);
     this.swordSpark.DefineAnimation(AnimType.Stopped, new Animation(AnimHitType.None, new Size(0x10, 0x10), new int[] { 0, 2, 1, 2 }, 2, false));
     this.swordSpark.GetAnimation(AnimType.Stopped).HitboxSize = new SizeF(16f, 16f);
     this.swordSpark.SetBehavior(new BlankBehavior());
     this.swordSpark.Visible = false;
     this.bulletMotion = new Move[] { new Move(new Speed(-1f, 0.1f, -0.2f), new Speed(-1f, 0.4f, 4f)), new Move(new Speed(-1.5f, 0.1f, -0.4f), new Speed(-2f, 0.4f, 4f)), new Move(new Speed(-2f, 0.1f, -0.6f), new Speed(-3f, 0.4f, 4f)), new Move(new Speed(-2.5f, 0.1f, -0.8f), new Speed(-4f, 0.4f, 4f)), new Move(new Speed(-3f, 0.1f, -1f), new Speed(-5f, 0.4f, 4f)) };
 }
Ejemplo n.º 17
0
 public override bool DoAction(GameObject o)
 {
     if (!this.started)
     {
         this.started = true;
         if (Utility.RandomInt(1, 3) == 3)
         {
             o.XSpeed.SetSpeed((float) 0f);
             o.YSpeed.SetSpeed(-this.speed);
         }
         else
         {
             o.XSpeed.SetSpeed((float) 0f);
             o.YSpeed.SetSpeed((float) 0f);
             new Move(this.speed, 0f).DoAction(o);
             new Reverse().DoAction(o);
         }
     }
     o.CurrentAnimation = AnimType.Stopped;
     int num = 0;
     if (o.Y < -100f)
     {
         num = Utility.RandomInt(80, 270);
         o.RepositionObject(new PointF((float) num, 340f));
         o.XSpeed.SetSpeed((float) 0f);
         o.YSpeed.SetSpeed(-this.speed);
         new FacePlayer().DoAction(o);
         return true;
     }
     if (o.X < -100f)
     {
         num = Utility.RandomInt(140, 200);
         o.CurrentDirection = Direction.Left;
         o.XSpeed.SetSpeed(-this.speed);
         o.RepositionObject(new PointF(400f, (float) num));
         return true;
     }
     if (o.X > 400f)
     {
         num = Utility.RandomInt(140, 200);
         o.CurrentDirection = Direction.Right;
         o.XSpeed.SetSpeed(this.speed);
         o.RepositionObject(new PointF(-100f, o.Y));
         return true;
     }
     return false;
 }
Ejemplo n.º 18
0
 public override bool DoAction(GameObject o)
 {
     if (this.waiting)
     {
         this.timeLeft--;
         this.waiting = this.timeLeft > 0;
         return false;
     }
     if (this.action.DoAction(o))
     {
         this.action.Reset();
         this.timeLeft = this.delay;
         this.waiting = true;
         this.numLeft--;
         return (this.numLeft == 0);
     }
     return false;
 }
Ejemplo n.º 19
0
 public override bool DoAction(GameObject o)
 {
     this.curTarget = this.target;
     if (!this.started)
     {
         if (!this.relativeToPlayer)
         {
             this.curTarget += (int) o.Location.Y;
         }
         this.started = true;
         o.YSpeed.SetSpeed((float) this.speed);
         return false;
     }
     if (this.relativeToPlayer)
     {
         this.curTarget += (int) GameEngine.Game.GetPlayer().Location.Y;
     }
     return (o.Location.Y > this.curTarget);
 }
Ejemplo n.º 20
0
 public override void InitScene()
 {
     this.text[0] = new GameText("GAME OVER");
     this.text[0].Shadow = true;
     this.text[0].Location = (PointF) new Point(120, 70);
     this.text[1] = new GameText("TO CONTINUE");
     this.text[1].Shadow = true;
     this.text[1].Location = (PointF) new Point(110, 110);
     this.text[2] = new GameText("PUSH BUTTON 1");
     this.text[2].Shadow = true;
     this.text[2].Location = (PointF) new Point(110, 130);
     this.hearts = new GameTexture("cursor.bmp", new Size(0x10, 0x10), TextureDisposePolicy.DisposeOnSceneChange);
     this.heartLines = new bool[4, this.heartsPerSide];
     this.deadPlayer = ObjectFactory.CreateObjectOfType(ObjectType.DeadPlayer);
     this.deadPlayer.Location = new PointF(150f, 200f);
     this.deadPlayer.Visible = true;
     this.deadPlayer.StopsAtBoundries = false;
     base.BackColor = Color.FromArgb(0xff, 0, 0x6b, 0xff);
     base.drawStatusBar = false;
 }
Ejemplo n.º 21
0
 public override bool DoAction(GameObject o)
 {
     if (this.state == 0)
     {
         this.started = false;
         if (Utility.RandomInt(1, 100) < 0x4b)
         {
             this.state = 1;
         }
         else
         {
             this.state = 2;
         }
     }
     if (this.state == 1)
     {
         if (!this.started)
         {
             this.started = true;
             this.facePlayer.DoAction(o);
         }
         if (this.jump.DoAction(o))
         {
             this.jump.Reset();
             this.started = false;
         }
         return false;
     }
     if (this.state == 2)
     {
         if (!this.started)
         {
             this.started = true;
             this.reverse.DoAction(o);
         }
         this.wait.DoAction(o);
     }
     return true;
 }
Ejemplo n.º 22
0
 public override bool DoAction(GameObject o)
 {
     if (!this.positionSet)
     {
         this.positionSet = true;
         this.basePosition = o.Location.Y;
         return true;
     }
     if (!this.started)
     {
         this.started = true;
         if (o.Location.Y > this.basePosition)
         {
             o.YSpeed.SetSpeed((float) -2f);
         }
         else
         {
             o.YSpeed.SetSpeed((float) 2f);
         }
         return false;
     }
     return (((o.Location.Y <= this.basePosition) && (o.YSpeed.CurrentSpeed < 0f)) || ((o.Location.Y >= this.basePosition) && (o.YSpeed.CurrentSpeed > 0f)));
 }
Ejemplo n.º 23
0
 public TransformSpiritBehavior(GameObject p_thisObject, ObjectType p_transform)
 {
     this.transform = p_transform;
     this.thisObject = p_thisObject;
     if (p_transform == ObjectType.Fox)
     {
         this.transform = GameEngine.Game.GetPlayerStats().LatestTransform;
         this.nextMap = "town";
     }
     else
     {
         if (p_transform > ObjectType.Hawk)
         {
             p_transform = ObjectType.Hawk;
         }
         if (this.transform == ObjectType.Lizard)
         {
             this.nextMap = "castle6b";
         }
         else if (this.transform == ObjectType.Mouse)
         {
             this.nextMap = "underdesert3";
         }
         else if (this.transform == ObjectType.Piranha)
         {
             this.nextMap = "jungle10";
         }
         else if (this.transform == ObjectType.Tiger)
         {
             this.nextMap = "ocean5";
         }
         else
         {
             this.nextMap = "cave12";
         }
     }
 }
Ejemplo n.º 24
0
 public override bool DoAction(GameObject o)
 {
     if (this.chosen == -1)
     {
         int num = Utility.RandomInt(1, 100);
         for (int i = 0; (i < this.actions.Length) && (this.chosen == -1); i++)
         {
             if (num <= this.chances[i])
             {
                 this.chosen = i;
             }
         }
     }
     if (this.delay >= 0)
     {
         this.delay--;
         return (this.delay == 0);
     }
     if (this.actions[this.chosen].DoAction(o))
     {
         this.delay = this.delays[this.chosen];
     }
     return false;
 }
Ejemplo n.º 25
0
        public override bool DoAction(GameObject o)
        {
            bool flag = false;
            float x = GameEngine.Game.GetPlayer().X;
            this.timer.Update();
            switch (this.phase)
            {
                case 0:
                    o.XSpeed.Acceleration = 1f;
                    o.XSpeed.TargetSpeed = -this.speed;
                    o.CurrentDirection = Direction.Left;
                    if ((x > 80f) && (o.X < 90f))
                    {
                        flag = true;
                    }
                    if (((x < 80f) || (x > 240f)) && (o.X < 180f))
                    {
                        flag = true;
                    }
                    if (flag)
                    {
                        this.phase = 1;
                        this.shotsLeft = 15;
                        new FacePlayer().DoAction(o);
                    }
                    break;

                case 1:
                    o.XSpeed.TargetSpeed = 0f;
                    o.XSpeed.Acceleration = 0.1f;
                    if ((o.XSpeed.CurrentSpeed != 0f) || (this.shotsLeft <= 0))
                    {
                        if (this.shotsLeft == 0)
                        {
                            this.phase = 2;
                        }
                        break;
                    }
                    if (this.timer.Timer == 0)
                    {
                        if (this.shootActs[this.curAct].DoAction(o))
                        {
                            this.curAct++;
                            if (this.curAct > 9)
                            {
                                this.curAct = 0;
                            }
                            this.timer.Timer = this.timer.Max;
                            this.shootActs[this.curAct].Reset();
                        }
                        this.shotsLeft--;
                    }
                    break;

                case 2:
                    o.CurrentDirection = Direction.Right;
                    o.CurrentAnimation = AnimType.Stopped2;
                    o.XSpeed.TargetSpeed = this.speed;
                    o.XSpeed.Acceleration = 1f;
                    if (o.X > (GameEngine.ScreenWidth - 30))
                    {
                        o.XSpeed.SetSpeed((float) 0f);
                        this.phase = 3;
                        this.yPos = o.Y;
                    }
                    break;

                case 3:
                    o.CurrentDirection = Direction.Left;
                    if (this.descending || (o.Y >= 150f))
                    {
                        if (!this.descending && (o.Y < (this.yPos - 30f)))
                        {
                            o.YSpeed.SetSpeed((float) 0f);
                            this.phase = 0;
                        }
                        else if ((o.Y > (GameEngine.ScreenHeight - 0x12)) && this.descending)
                        {
                            this.descending = false;
                            o.YSpeed.SetSpeed((float) 0f);
                            this.phase = 0;
                        }
                        else if (!this.descending)
                        {
                            o.YSpeed.Acceleration = 1f;
                            o.YSpeed.TargetSpeed = -this.vSpeed;
                        }
                        break;
                    }
                    this.descending = true;
                    o.YSpeed.Acceleration = 1f;
                    o.YSpeed.TargetSpeed = this.vSpeed;
                    break;
            }
            return false;
        }
Ejemplo n.º 26
0
 public void HandleHit(GameObject colObject)
 {
 }
Ejemplo n.º 27
0
 public void ResetPlayer(ObjectType transform)
 {
     GameEngine.Game.OnSetTransform(transform, true);
     this.objects.Remove(this.player);
     this.gameObjects.Remove(this.player);
     this.player = ObjectFactory.CreateObjectOfType(transform, ColorSwaps.Normal, Direction.Right, "", 0);
     this.objects.Add(this.player);
     this.gameObjects.Add(this.player);
     GameEngine.Game.SetPlayer(this.player);
 }
Ejemplo n.º 28
0
 public void HandleMechaXDeath(GameObject mechaX)
 {
     this.singleMoveObject = mechaX;
     mechaX.Blink(300);
     GameObject item = ObjectFactory.CreateObjectOfType(ObjectType.FinalDragon, ColorSwaps.Normal, Direction.Left, "", 0);
     item.X = mechaX.X;
     item.Y = mechaX.Y - 30f;
     this.addedObjects.Add(item);
     this.flashColor = Color.Red;
     this.flashDuration = 180;
     this.state = SceneState.FinalBossTransform;
 }
Ejemplo n.º 29
0
 public void HandleFinalBossDeath()
 {
     if (this.state != SceneState.FinalBossDeath)
     {
         foreach (GameObject obj2 in this.gameObjects)
         {
             if (obj2.Type == ObjectType.FinalDragon)
             {
                 this.singleMoveObject = obj2;
             }
         }
         this.state = SceneState.FinalBossDeath;
     }
 }
Ejemplo n.º 30
0
 public GameObject GetCollidingObject(GameObject obj, ObjectClass objectClass)
 {
     foreach (GameObject obj2 in this.gameObjects)
     {
         if (obj2.ObjClass == objectClass)
         {
             if (obj2.CurAnimHitType == AnimHitType.HeadOnly)
             {
                 if (obj.GetCollisionRectangle().IntersectsWith(obj2.GetShieldSwordRectangle()))
                 {
                     return obj2;
                 }
             }
             else if (obj.GetCollisionRectangle().IntersectsWith(obj2.GetCollisionRectangle()))
             {
                 return obj2;
             }
         }
     }
     return null;
 }