private static void RotateEvent(RotateEvent ev)
 {
     if (ev.Sender.TryGetComponent(out ParticleAcceleratorPartComponent? part))
     {
         part.Rotated();
     }
 }
Ejemplo n.º 2
0
        private void OnRotateEvent(EntityUid uid, NodeContainerComponent container, ref RotateEvent ev)
        {
            if (ev.NewRotation == ev.OldRotation)
            {
                return;
            }

            var xform = Transform(uid);

            foreach (var node in container.Nodes.Values)
            {
                if (node is not IRotatableNode rotatableNode)
                {
                    continue;
                }

                // Don't bother updating nodes that can't even be connected to anything atm.
                if (!node.Connectable(EntityManager, xform))
                {
                    continue;
                }

                if (rotatableNode.RotateEvent(ref ev))
                {
                    _nodeGroupSystem.QueueReflood(node);
                }
            }
        }
Ejemplo n.º 3
0
 private void RotateEvent(RotateEvent ev)
 {
     if (ev.Sender.TryGetComponent(out AirtightComponent? airtight))
     {
         airtight.RotateEvent(ev);
     }
 }
 private void RotateEvent(ref RotateEvent ev)
 {
     if (EntityManager.TryGetComponent(ev.Sender, out ParticleAcceleratorPartComponent? part))
     {
         part.Rotated();
     }
 }
Ejemplo n.º 5
0
        private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, RotateEvent ev)
        {
            if (!airtight.RotateAirBlocked || airtight.InitialAirBlockedDirection == (int)AtmosDirection.Invalid)
            {
                return;
            }

            airtight.CurrentAirBlockedDirection = (int)Rotate((AtmosDirection)airtight.InitialAirBlockedDirection, ev.NewRotation);
            UpdatePosition(airtight);
        }
    // TODO: Shitcode, needs to use sprites instead of actual offsets.
    private void OnVehicleRotate(EntityUid uid, VehicleComponent component, ref RotateEvent args)
    {
        // This first check is just for safety
        if (!HasComp <InputMoverComponent>(uid))
        {
            UpdateAutoAnimate(uid, false);
            return;
        }

        UpdateBuckleOffset(args.Component, component);
        UpdateDrawDepth(uid, GetDrawDepth(args.Component, component.NorthOnly));
    }
        private void RotateEvent(RotateEvent ev)
        {
            if (ev.Sender != Owner || ev.NewRotation == ev.OldRotation)
            {
                return;
            }

            foreach (var rotatableNode in Nodes.OfType <IRotatableNode>())
            {
                rotatableNode.RotateEvent(ev);
            }
        }
Ejemplo n.º 8
0
 private void RotateEvent(EntityUid uid, StrapComponent strap, ref RotateEvent ev)
 {
     // On rotation of a strap, reattach all buckled entities.
     // This fixes buckle offsets and draw depths.
     foreach (var buckledEntity in strap.BuckledEntities)
     {
         if (!EntityManager.TryGetComponent(buckledEntity, out BuckleComponent? buckled))
         {
             continue;
         }
         buckled.ReAttach(strap);
         buckled.Dirty();
     }
 }
Ejemplo n.º 9
0
        private void OnAirtightInit(EntityUid uid, AirtightComponent airtight, ComponentInit args)
        {
            if (airtight.FixAirBlockedDirectionInitialize)
            {
                var rotateEvent = new RotateEvent(airtight.Owner, Angle.Zero, airtight.Owner.Transform.WorldRotation);
                OnAirtightRotated(uid, airtight, ref rotateEvent);
            }

            // Adding this component will immediately anchor the entity, because the atmos system
            // requires airtight entities to be anchored for performance.
            airtight.Owner.Transform.Anchored = true;

            UpdatePosition(airtight);
        }
        private void OnStrapRotate(EntityUid uid, SharedStrapComponent component, ref RotateEvent args)
        {
            // TODO: This looks dirty af.
            // On rotation of a strap, reattach all buckled entities.
            // This fixes buckle offsets and draw depths.
            foreach (var buckledEntity in component.BuckledEntities)
            {
                if (!EntityManager.TryGetComponent(buckledEntity, out SharedBuckleComponent? buckled))
                {
                    continue;
                }

                buckled.ReAttach(component);
                Dirty(buckled);
            }
        }
Ejemplo n.º 11
0
        public void StoreTurnsEventTest()
        {
            //ARRANGE
            var @event = new RotateEvent(new Guid(), RotateDirection.Left);

            var command = new MoveCommand(store);

            //ACT
            command.Handle(@event);

            var storedEvents = store.GetEvents <MoveEvent>();

            //ASSERT
            Assert.AreEqual(true, storedEvents.Contains(@event));
            Assert.AreEqual(1, storedEvents.Count);
        }
Ejemplo n.º 12
0
        private void OnRotateEvent(EntityUid uid, NodeContainerComponent container, RotateEvent ev)
        {
            if (ev.NewRotation == ev.OldRotation)
            {
                return;
            }

            foreach (var node in container.Nodes.Values)
            {
                if (node is not IRotatableNode rotatableNode)
                {
                    continue;
                }
                rotatableNode.RotateEvent(ev);
            }
        }
Ejemplo n.º 13
0
        public void Rotate(Vector3 v, float deltaTime, bool active = false)
        {
            var speed = acceleration.GetSpeed(deltaTime, rotationSpeed, active);

            movement.Rotate(v * speed);

            if (previousRotationSpeed < 0.1f && speed != previousRotationSpeed)
            {
                RotateEvent?.Invoke();
            }
            else if (previousRotationSpeed > 0.1f && speed == 0)
            {
                StopEvent?.Invoke();
            }
            previousRotationSpeed = speed;
        }
Ejemplo n.º 14
0
        public void LookRotate(Vector3 v, float deltaTime, bool active = false)
        {
            var speed = acceleration.GetSpeed(deltaTime, rotationSpeed, active);

            currentLookRotation = Vector3.Lerp(currentLookRotation, v, speed);
            movement.LookRotate(currentLookRotation);

            if (previousLookRotationSpeed < 0.1f && speed != previousLookRotationSpeed)
            {
                RotateEvent?.Invoke();
            }
            else if (previousLookRotationSpeed > 0.1f && speed == 0)
            {
                StopEvent?.Invoke();
            }
            previousLookRotationSpeed = speed;
        }
Ejemplo n.º 15
0
        private void RotateEvent(RotateEvent ev)
        {
            if (!ev.Sender.TryGetComponent(out NodeContainerComponent container))
            {
                return;
            }

            if (ev.NewRotation == ev.OldRotation)
            {
                return;
            }

            foreach (var rotatableNode in container.Nodes.OfType <IRotatableNode>())
            {
                rotatableNode.RotateEvent(ev);
            }
        }
Ejemplo n.º 16
0
    // Start is called before the first frame update
    void Awake()
    {
        if (onRotateInput == null)
        {
            onRotateInput = new RotateEvent();
        }

        if (onSpaceDown == null)
        {
            onSpaceDown = new UnityEvent();
        }
        if (onSpaceUp == null)
        {
            onSpaceUp = new UnityEvent();
        }

        spaceDown = false;
    }
Ejemplo n.º 17
0
 private void OnRotateEvent(ITransformable transformable, Matrix delta, Matrix deleta2)
 {
     RotateEvent?.Invoke(transformable, new TransformationEventArgs(delta, ActivePivot));
 }
Ejemplo n.º 18
0
 private void OnRotate(RotateEvent data)
 {
     _targetRot.y += data.Axis.x * RotateSensitivity;
     _targetRot.x -= data.Axis.y * RotateSensitivity;
     _targetRot.x  = ClampAngle(_targetRot.x, -80, 80);
 }
Ejemplo n.º 19
0
 private void OnAirtightRotated(EntityUid uid, AirtightComponent airtight, RotateEvent ev)
 {
     airtight.RotateEvent(ev);
 }
Ejemplo n.º 20
0
 public PinchHoldRotate(HandModel handModel, RotateEvent rotateEvent)
     : base(handModel)
 {
     _rotateEvent = rotateEvent;
     _pinch       = new PinchCondition(handModel, false);
 }
 public void HandleEvent(RotateEvent e) =>
 board.GetUnit(e.From).transform.rotation = (e.To - e.From).ToQuaternion();
Ejemplo n.º 22
0
 private static void OnRotateEvent(EntityUid uid, ParticleAcceleratorPartComponent component, ref RotateEvent args)
 {
     component.Rotated();
 }
Ejemplo n.º 23
0
 protected void OnRotate()
 {
     RotateEvent?.Invoke(RotateArgs);
 }