Пример #1
0
        public override void Process(Entity entity)
        {
            float dt = (float)EntitySystem.BlackBoard.GetEntry <double>("dt");
            GoalSpeedComponent goalSpeed = entity.GetComponent <GoalSpeedComponent>();
            SpeedComponent     speed     = entity.GetComponent <SpeedComponent>();

            speed.SpeedX = Approach(speed.SpeedX, Math.Abs(goalSpeed.AccelX * dt), goalSpeed.GoalSpeedX);
            speed.SpeedY = Approach(speed.SpeedY, Math.Abs(goalSpeed.AccelY * dt), goalSpeed.GoalSpeedY);
        }
        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;
        }
Пример #3
0
        public override void Process(Entity entity)
        {
            LinkOnGroundStateComponent onGround        = entity.GetComponent <LinkOnGroundStateComponent>();
            GoalSpeedComponent         goalSpeed       = entity.GetComponent <GoalSpeedComponent>();
            BinaryDirectionComponent   binaryDirection = entity.GetComponent <BinaryDirectionComponent>();
            SpriteComponent            sprite          = entity.GetComponent <SpriteComponent>();

            sprite.Name          = "spr/Link/Stand";
            goalSpeed.AccelX     = onGround.Accel * (int)binaryDirection.Direction * -1;
            goalSpeed.GoalSpeedX = 0;
        }
        public override void OnAdded(Entity entity)
        {
            base.OnAdded(entity);
            LinkOnAirStateComponent onAir       = entity.GetComponent <LinkOnAirStateComponent>();
            SpeedComponent          speed       = entity.GetComponent <SpeedComponent>();
            GoalSpeedComponent      goalSpeed   = entity.GetComponent <GoalSpeedComponent>();
            EventSenderComponent    eventSender = entity.GetComponent <EventSenderComponent>();

            goalSpeed.GoalSpeedY = onAir.MaxVerticalSpeed;
            goalSpeed.AccelY     = onAir.Gravity;
            goalSpeed.GoalSpeedX = speed.Speed.X;

            eventSender.GenericEvent += Event;
        }
Пример #5
0
        public override void Process(Entity entity)
        {
            LinkOnGroundStateComponent onGround        = entity.GetComponent <LinkOnGroundStateComponent>();
            LinkRunStateComponent      run             = entity.GetComponent <LinkRunStateComponent>();
            SpeedComponent             speed           = entity.GetComponent <SpeedComponent>();
            GoalSpeedComponent         goalSpeed       = entity.GetComponent <GoalSpeedComponent>();
            BinaryDirectionComponent   binaryDirection = entity.GetComponent <BinaryDirectionComponent>();
            SpriteComponent            sprite          = entity.GetComponent <SpriteComponent>();

            goalSpeed.AccelX     = onGround.Accel * (int)binaryDirection.Direction;
            goalSpeed.GoalSpeedX = run.MaxRunSpeed * (int)binaryDirection.Direction;

            sprite.Name = "spr/Link/Run";
            if (Math.Sign(-speed.SpeedX) == (int)binaryDirection.Direction)
            {
                sprite.Name = "spr/Link/Skid";
            }
        }