Ejemplo n.º 1
0
        public override void Process(Entity entity)
        {
            LinkOnGroundStateComponent  onGround        = entity.GetComponent <LinkOnGroundStateComponent>();
            LinkWalkSpeedStateComponent walkSpeed       = entity.GetComponent <LinkWalkSpeedStateComponent>();
            GoalSpeedComponent          goalSpeed       = entity.GetComponent <GoalSpeedComponent>();
            BinaryDirectionComponent    binaryDirection = entity.GetComponent <BinaryDirectionComponent>();

            goalSpeed.AccelX     = onGround.Accel * (int)binaryDirection.Direction;
            goalSpeed.GoalSpeedX = walkSpeed.MaxWalkSpeed * (int)binaryDirection.Direction;
        }
        public override void Process(Entity entity)
        {
            SpeedComponent  speed  = entity.GetComponent <SpeedComponent>();
            SpriteComponent sprite = entity.GetComponent <SpriteComponent>();

            if (speed.Speed.Y < 0)
            {
                LinkWalkSpeedStateComponent walkSpeed       = entity.GetComponent <LinkWalkSpeedStateComponent>();
                BinaryDirectionComponent    binaryDirection = entity.GetComponent <BinaryDirectionComponent>();
                if (Math.Sign(speed.SpeedX) == (int)binaryDirection.Direction && Math.Abs(speed.SpeedX) > walkSpeed.MaxWalkSpeed)
                {
                    sprite.Name = "spr/Link/JumpFwd";
                }
                else
                {
                    sprite.Name = "spr/Link/Jump";
                }
            }
            else
            {
                sprite.Name = "spr/Link/Fall";
            }
        }