Beispiel #1
0
        /// <summary>
        /// Handle MoveEntityTo events.
        /// </summary>
        /// <param name="evt">
        /// The <see cref="IEvent"/> event to handle.
        /// </param>
        private void OnMoveEntityTo(IEvent evt)
        {
            MoveEntityToEventData data = (MoveEntityToEventData)evt.EventData;

            if ((!this.Enabled) && (!data.IgnorePaused))
            {
                return;
            }

            MovableComponent movable;

            if (!this.Game.ComponentSystem.TryGetComponent <MovableComponent>(data.EntityId, out movable))
            {
                return;
            }

            this.MoveMovableToPosition(movable, data.Position);
        }
        /// <summary>
        /// Update this system. If <see cref="PaddleSystem.Enabled"/> is set to <c>true</c>,
        /// all paddles will be moved by the input value of their configured axis.
        /// </summary>
        public override void Update()
        {
            if (! this.Enabled)
            {
                return;
            }

            float axisValue;
            Vector3 position;
            Vector3 target;

            foreach (PaddleComponent paddle in this.Game.ComponentSystem.Components<PaddleComponent>())
            {
                axisValue = Input.GetAxis(paddle.InputAxis);
                position = paddle.gameObject.transform.position;
                target = position + (paddle.MovementVector * axisValue * Time.deltaTime);

                MoveEntityToEventData data = new MoveEntityToEventData(paddle.EntityId, target);
                this.Game.EventManager.QueueEvent(new HelGamesEvent(BreakoutEvents.MoveEntityTo, data));
            }
        }
Beispiel #3
0
        /// <summary>
        /// Update this system. If <see cref="PaddleSystem.Enabled"/> is set to <c>true</c>,
        /// all paddles will be moved by the input value of their configured axis.
        /// </summary>
        public override void Update()
        {
            if (!this.Enabled)
            {
                return;
            }

            float   axisValue;
            Vector3 position;
            Vector3 target;

            foreach (PaddleComponent paddle in this.Game.ComponentSystem.Components <PaddleComponent>())
            {
                axisValue = Input.GetAxis(paddle.InputAxis);
                position  = paddle.gameObject.transform.position;
                target    = position + (paddle.MovementVector * axisValue * Time.deltaTime);

                MoveEntityToEventData data = new MoveEntityToEventData(paddle.EntityId, target);
                this.Game.EventManager.QueueEvent(new HelGamesEvent(BreakoutEvents.MoveEntityTo, data));
            }
        }