示例#1
0
 private void SlammerHasReset()
 {
     this.state = SlammerState.Passive;
     this.physics.velocity.Y = FInt.Create(0);
     this.fallAccel          = FInt.Create(0);
     this.physics.MoveToPosY(this.startY);
 }
示例#2
0
        public void EndSlam(GameObject actor)
        {
            this.state = SlammerState.ResetDelay;
            this.physics.velocity.Y = FInt.Create(0);
            this.fallAccel          = FInt.Create(0);
            this.resetFrame         = Systems.timer.Frame + this.resetDelay;

            // Sound the Thud.
            actor.room.PlaySound(Systems.sounds.thudWhomp, 0.5f, actor.posX + 16, actor.posY + 16);
        }
示例#3
0
        public override void RunTick()
        {
            // While Slammer is Passive
            if (this.state == SlammerState.Passive)
            {
                if (this.viewHeight == 0)
                {
                    return;
                }

                // Check for Characters within Slammer's View. Being Slamming if one is found.
                int objectId = CollideRect.FindOneObjectTouchingArea(
                    this.actor.room.objects[(byte)LoadOrder.Character],
                    this.actor.posX + 8,
                    this.viewY,
                    (byte)TilemapEnum.TileWidth * 2 - 20,
                    this.viewHeight
                    );

                if (objectId > 0)
                {
                    this.state = SlammerState.Slamming;
                }
            }

            // While Slammer is Slamming
            else if (this.state == SlammerState.Slamming)
            {
                this.fallAccel += FInt.Create(0.12);
                if (this.fallAccel > 2)
                {
                    this.fallAccel = FInt.Create(2);
                }
                this.physics.velocity.Y += this.fallAccel;

                // If Slammer has completed its maximum journey.
                if (this.actor.posY >= this.endY)
                {
                    this.EndSlam(this.actor);
                    return;
                }
            }

            // While Slammer is Reset Delayed
            else if (this.state == SlammerState.ResetDelay)
            {
                if (this.resetFrame <= Systems.timer.Frame)
                {
                    this.state = SlammerState.Resetting;
                }
            }

            // While Slammer is Resetting
            else if (this.state == SlammerState.Resetting)
            {
                this.physics.velocity.Y -= FInt.Create(0.3);
                if (this.actor.posY <= this.startY)
                {
                    this.SlammerHasReset();
                }
            }
        }