示例#1
0
        public void Update(ITime engineTime, float deltaSeconds)
        {
            LightStyles.AnimateLights(engineTime);

            VectorUtils.AngleToVectors(Angles, out _viewAngles);

            foreach (IUpdateable updateable in _updateables)
            {
                updateable.Update(deltaSeconds);
            }
        }
示例#2
0
        /// <summary>
        /// Starts the door going to its "up" position (simply ToggleData->vecPosition2).
        /// </summary>
        /// <param name=""></param>
        private void DoorGoUp()
        {
            // It could be going-down, if blocked.
            Debug.Assert(m_toggle_state == ToggleState.AtBottom || m_toggle_state == ToggleState.GoingDown);

            // emit door moving and stop sounds on CHAN_STATIC so that the multicast doesn't
            // filter them out and leave a client stuck with looping door sounds!
            if ((SpawnFlags & SF.DoorSilent) == 0)
            {
                if (m_toggle_state != ToggleState.GoingUp && m_toggle_state != ToggleState.GoingDown)
                {
                    //TODO
                    //EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
                }
            }

            m_toggle_state = ToggleState.GoingUp;

            SetMoveDone(DoorHitTop);

            if (ClassName == "func_door_rotating")        // !!! BUGBUG Triggered doors don't work with this yet
            {
                var sign = 1.0f;

                var activator = Activator;

                if (activator != null)
                {
                    if ((SpawnFlags & SF.DoorOneWay) == 0 && MoveDirection.Y != 0)        // Y axis rotation, move away from the player
                    {
                        var vec = activator.Origin - Origin;

                        //			Vector vnext = (pevToucher->origin + (pevToucher->velocity * 10)) - pev->origin;
                        VectorUtils.AngleToVectors(activator.Angles, out var forward, out _, out _);
                        var vnext = (activator.Origin + (forward * 10)) - Origin;

                        if (((vec.X * vnext.Y) - (vec.Y * vnext.X)) < 0)
                        {
                            sign = -1.0f;
                        }
                    }
                }

                AngularMove(m_vecAngle2 * sign, Speed);
            }
            else
            {
                LinearMove(m_vecPosition2, Speed);
            }
        }
示例#3
0
        /// <summary>
        /// QuakeEd only writes a single float for angles (bad idea), so up and down are just constant angles.
        /// </summary>
        /// <param name="entity"></param>
        public static void SetMoveDir(BaseEntity entity)
        {
            if (entity.Angles == Up)
            {
                entity.MoveDirection = new Vector3(0, 0, 1);
            }
            else if (entity.Angles == Down)
            {
                entity.MoveDirection = new Vector3(0, 0, -1);
            }
            else
            {
                VectorUtils.AngleToVectors(entity.Angles, out var forward, out _, out _);
                entity.MoveDirection = forward;
            }

            entity.Angles = Vector3.Zero;
        }
        /// <summary>
        /// QuakeEd only writes a single float for angles (bad idea), so up and down are just constant angles.
        /// </summary>
        /// <param name="transform"></param>
        public static void SetMoveDir(Transform transform)
        {
            if (transform.Angles == Up)
            {
                transform.MoveDirection = new Vector3(0, 0, 1);
            }
            else if (transform.Angles == Down)
            {
                transform.MoveDirection = new Vector3(0, 0, -1);
            }
            else
            {
                VectorUtils.AngleToVectors(transform.Angles, out var forward, out _, out _);
                transform.MoveDirection = forward;
            }

            transform.Angles = Vector3.Zero;
        }