コード例 #1
0
        public bool ValidateServerCertificate(
            object sender,
            X509Certificate certificate,
            X509Chain chain,
            SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors == SslPolicyErrors.None)
            {
                return(true);
            }
            txtTerminal.AppendText(">>>>>>>> SSL ERROR <<<<<<<<<");
            txtTerminal.AppendText(Environment.NewLine);
            var msg = new StringBuilder();

            msg.AppendLine("Ssl Policy Errors!");
            if (FlagsHelper.IsSet(sslPolicyErrors, SslPolicyErrors.RemoteCertificateChainErrors))
            {
                msg.AppendLine("Remote certificate chain cannot be verified.");
            }
            if (FlagsHelper.IsSet(sslPolicyErrors, SslPolicyErrors.RemoteCertificateNameMismatch))
            {
                msg.AppendLine("Remote certificate name mismatch.");
            }
            if (FlagsHelper.IsSet(sslPolicyErrors, SslPolicyErrors.RemoteCertificateNotAvailable))
            {
                msg.AppendLine("Remote certificate not available.");
            }

            MessageBoxResult result = System.Windows.MessageBox.Show(msg.ToString(), "Warning", MessageBoxButton.YesNo,
                                                                     MessageBoxImage.Warning);

            return(result == MessageBoxResult.Yes);
        }
コード例 #2
0
        private string GetShapeAndSize(RadialGradient gradient)
        {
            if (gradient.RadiusX > -1 && gradient.RadiusY > -1)
            {
                var radiusX = FlagsHelper.IsSet(gradient.Flags, RadialGradientFlags.WidthProportional)
                    ? $"{gradient.RadiusX * 100}%"
                    : $"{gradient.RadiusX}px";

                var radiusY = FlagsHelper.IsSet(gradient.Flags, RadialGradientFlags.HeightProportional)
                    ? $"{gradient.RadiusY * 100}%"
                    : $"{gradient.RadiusY}px";

                return($"ellipse {radiusX} {radiusY}");
            }

            var shape = gradient.Shape.ToString().ToLower();
            var size  = gradient.Size switch
            {
                RadialGradientSize.ClosestSide => "closest-side",
                RadialGradientSize.ClosestCorner => "closest-corner",
                RadialGradientSize.FarthestSide => "farthest-side",
                _ => "farthest-corner"
            };

            return($"{shape} {size}");
        }
コード例 #3
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (FlagsHelper.IsSet(Ships.value, Mathf.RoundToInt(Mathf.Pow(2, coll.gameObject.layer))) && firedFrom != coll.transform.root.gameObject && !hasHit)
     {
         hit(coll);
     }
 }
コード例 #4
0
        public void ApplyRectTransform(ViewElementTransform viewElementTransform, RectTransformFlag?overrideFlag = null)
        {
            var currentFlag = overrideFlag.HasValue ? overrideFlag.Value : viewElementTransform.rectTransformFlag;

            if (FlagsHelper.IsSet(currentFlag, RectTransformFlag.SizeDelta))
            {
                rectTransform.sizeDelta = viewElementTransform.rectTransformData.sizeDelta;
            }
            if (FlagsHelper.IsSet(currentFlag, RectTransformFlag.AnchoredPosition))
            {
                rectTransform.anchoredPosition3D = viewElementTransform.rectTransformData.anchoredPosition;
            }
            if (FlagsHelper.IsSet(currentFlag, RectTransformFlag.AnchorMax))
            {
                rectTransform.anchorMax = viewElementTransform.rectTransformData.anchorMax;
            }
            if (FlagsHelper.IsSet(currentFlag, RectTransformFlag.AnchorMin))
            {
                rectTransform.anchorMin = viewElementTransform.rectTransformData.anchorMin;
            }
            if (FlagsHelper.IsSet(currentFlag, RectTransformFlag.LocalEulerAngles))
            {
                rectTransform.localEulerAngles = viewElementTransform.rectTransformData.localEulerAngles;
            }
            if (FlagsHelper.IsSet(currentFlag, RectTransformFlag.LocalScale))
            {
                rectTransform.localScale = viewElementTransform.rectTransformData.localScale;
            }
            if (FlagsHelper.IsSet(currentFlag, RectTransformFlag.Pivot))
            {
                rectTransform.pivot = viewElementTransform.rectTransformData.pivot;
            }
        }
コード例 #5
0
    public CollisionState2D CheckProximity(float distance, Direction2D mask)
    {
        var proximityCollision = new CollisionState2D();

        // Check below
        if (FlagsHelper.IsSet(mask, Direction2D.DOWN))
        {
            proximityCollision.Below = CheckBelow(distance, data.skinWidth);
        }

        // Check above
        if (FlagsHelper.IsSet(mask, Direction2D.UP))
        {
            proximityCollision.Above = CheckAbove(distance, data.skinWidth);
        }

        // Check right.
        if (FlagsHelper.IsSet(mask, Direction2D.RIGHT))
        {
            proximityCollision.Right = CheckRight(distance, data.skinWidth);
        }

        // Check left
        if (FlagsHelper.IsSet(mask, Direction2D.LEFT))
        {
            proximityCollision.Left = CheckLeft(distance, data.skinWidth);
        }

        return(proximityCollision);
    }
コード例 #6
0
    public CollisionState2D CheckProximity(float distance, Direction2D mask)
    {
        var proximityCollision = new CollisionState2D();

        // Check below
        if (FlagsHelper.IsSet(mask, Direction2D.DOWN))
        {
            proximityCollision.Below = Check(Constants.Directions.DOWN, distance);
        }

        // Check above
        if (FlagsHelper.IsSet(mask, Direction2D.UP))
        {
            proximityCollision.Above = Check(Constants.Directions.UP, distance);
        }

        // Check right.
        if (FlagsHelper.IsSet(mask, Direction2D.RIGHT))
        {
            proximityCollision.Right = Check(Constants.Directions.RIGHT, distance);
        }

        // Check left
        if (FlagsHelper.IsSet(mask, Direction2D.LEFT))
        {
            proximityCollision.Left = Check(Constants.Directions.LEFT, distance);
        }

        return(proximityCollision);
    }
コード例 #7
0
ファイル: PlayerBall.cs プロジェクト: EternalGB/Robodoc
    void Update()
    {
        //to stop new colliders changing the center of mass
        GetComponent <Rigidbody2D>().centerOfMass = Vector2.zero;

        if (!FlagsHelper.IsSet <BallStatus>(status, BallStatus.FROZEN))
        {
            object contr;
            if (!Settings.TryGetSetting(Settings.SettingName.MOVCONTROLS, out contr))
            {
                movControls = Settings.ControlType.MOUSE;
                Debug.Log("Couldn't load move controls");
            }
            else
            {
                movControls = (Settings.ControlType)contr;
            }

            if (movControls == Settings.ControlType.MOUSE)
            {
                //move towards the mouse

                mousePos = Util.MouseToWorldPos(0);
                if (Vector2.Distance(mousePos, transform.position) >= 2)
                {
                    GetComponent <Rigidbody2D>().velocity = (mousePos - transform.position).normalized * speed;
                }
                else
                {
                    GetComponent <Rigidbody2D>().velocity = Vector2.zero;
                    transform.position = mousePos;
                }
            }
            else
            {
                //use the keyboard
                GetComponent <Rigidbody2D>().velocity = new Vector3(Input.GetAxis("Horizontal") * speed, Input.GetAxis("Vertical") * speed);
            }
        }


        if (bombsEnabled && Input.GetButtonDown("Bomb"))
        {
            FireBomb();
        }

        //spin left or right
        if (!FlagsHelper.IsSet <BallStatus>(status, BallStatus.SHOCKED))
        {
            rotAngle           = Mathf.Repeat(rotAngle + Input.GetAxisRaw("Spin") * rotSpeed * Time.deltaTime, 360);
            transform.rotation = Quaternion.AngleAxis(rotAngle, Vector3.forward);
            //rigidbody2D.angularVelocity += new Vector3(0,0,rigidbody2D.velocity.x + rigidbody2D.velocity.y)*-0.1f;
        }

        //reduce the size of the halo
        halo.localScale = new Vector3(Mathf.Clamp(halo.localScale.x - haloDecrement * Time.deltaTime, 0, 1), Mathf.Clamp(halo.localScale.x - haloDecrement * Time.deltaTime, 0, 1));

        Debug.DrawLine(transform.position, (Vector2)transform.position + GetComponent <Rigidbody2D>().velocity, Color.blue, 0f);
    }
コード例 #8
0
 // Handlers
 public void HandleLimbAttached(Limb skeletonLimbs, Limb attachedLimb)
 {
     if (FlagsHelper.IsSet(skeletonLimbs, Limb.HAND | Limb.BODY, Logical.AND))
     {
         skeleton.hand.entity.SetPosition(skeleton.body.entity.Position);
         skeleton.SetActive(Limb.HAND, true);
     }
 }
コード例 #9
0
ファイル: PlayerBall.cs プロジェクト: EternalGB/Robodoc
 public void GetShocked(float duration, Material shockedMat)
 {
     if (!FlagsHelper.IsSet <BallStatus>(status, BallStatus.SHOCKED))
     {
         GetComponent <Renderer>().sharedMaterial = shockedMat;
         AddStatus(BallStatus.SHOCKED, shockedMat);
         AttachedBall.AddStatusAllAttachedBalls(transform, BallStatus.SHOCKED, shockedMat);
         StartCoroutine(Timers.Countdown(duration, () => RemoveStatus(BallStatus.SHOCKED, shockedMat)));
     }
 }
コード例 #10
0
    public override string ToString()
    {
        var rightStr = FlagsHelper.IsSet(direction.Flags, Direction2D.RIGHT);
        var leftStr  = FlagsHelper.IsSet(direction.Flags, Direction2D.LEFT);
        var upStr    = FlagsHelper.IsSet(direction.Flags, Direction2D.UP);
        var downStr  = FlagsHelper.IsSet(direction.Flags, Direction2D.DOWN);

        return(string.Format("[CharacterCollisionState2D] r: {0}, l: {1}, a: {2}, b: {3}, movingDownSlope: {4}, angle: {5}, becameGroundedThisFrame: {6}",
                             rightStr, leftStr, upStr, downStr, movingDownSlope, slopeAngle, becameGroundedThisFrame));
    }
コード例 #11
0
    public bool IsCollisionBuffered(Direction2D direction)
    {
        var result = false;

        foreach (CollisionState2D collisionState in collisionBuffer)
        {
            result |= FlagsHelper.IsSet(collisionState.direction.Flags, direction);
        }

        return(result);
    }
コード例 #12
0
 public void UpdateStateObjects()
 {
     if (OWInput.GetInputMode() == InputMode.None)
     {
         return;
     }
     FlashLight?.UpdateState(FlagsHelper.IsSet(State, State.Flashlight));
     Translator?.ChangeEquipState(FlagsHelper.IsSet(State, State.Translator));
     ProbeLauncher?.ChangeEquipState(FlagsHelper.IsSet(State, State.ProbeLauncher));
     Signalscope?.ChangeEquipState(FlagsHelper.IsSet(State, State.Signalscope));
     PlayerRegistry.GetSyncObject <AnimationSync>(NetId)?.SetSuitState(FlagsHelper.IsSet(State, State.Suit));
 }
コード例 #13
0
ファイル: Tile.cs プロジェクト: eimink/KoboldAI
        public float GetAccessCost(AccessType accessMethod)
        {
            AccessCost ac = AccessCosts.Find(p => FlagsHelper.IsSet(p.Type, accessMethod));

            if (ac != null)
            {
                return(ac.Cost);
            }
            else
            {
                return(Mathf.Infinity);
            }
        }
コード例 #14
0
 public void UpdateStateObjects()
 {
     if (OWInput.GetInputMode() == InputMode.None)
     {
         return;
     }
     FlashLight?.UpdateState(FlagsHelper.IsSet(State, State.Flashlight));
     Translator?.ChangeEquipState(FlagsHelper.IsSet(State, State.Translator));
     ProbeLauncher?.ChangeEquipState(FlagsHelper.IsSet(State, State.ProbeLauncher));
     Signalscope?.ChangeEquipState(FlagsHelper.IsSet(State, State.Signalscope));
     QSBCore.UnityEvents.RunWhen(() => QSBPlayerManager.GetSyncObject <AnimationSync>(PlayerId) != null,
                                 () => QSBPlayerManager.GetSyncObject <AnimationSync>(PlayerId).SetSuitState(FlagsHelper.IsSet(State, State.Suit)));
 }
コード例 #15
0
        private string GetPosition(RadialGradient gradient)
        {
            var center = gradient.Center;

            var posX = FlagsHelper.IsSet(gradient.Flags, RadialGradientFlags.XProportional)
                ? $"{center.X * 100}%"
                : $"{center.X}px";

            var posY = FlagsHelper.IsSet(gradient.Flags, RadialGradientFlags.YProportional)
                ? $"{center.Y * 100}%"
                : $"{center.Y}px";

            return($"at {posX} {posY}");
        }
コード例 #16
0
ファイル: PlayerBall.cs プロジェクト: EternalGB/Robodoc
 public void GetFrozen(float duration, Material frozenMat)
 {
     if (!FlagsHelper.IsSet <BallStatus>(status, BallStatus.FROZEN))
     {
         GetComponent <Renderer>().sharedMaterial = frozenMat;
         AddStatus(BallStatus.FROZEN, frozenMat);
         GetComponent <Rigidbody2D>().velocity    = Vector2.zero;
         GetComponent <Rigidbody2D>().isKinematic = true;
         AttachedBall.AddStatusAllAttachedBalls(transform, BallStatus.FROZEN, frozenMat);
         StartCoroutine(Timers.Countdown(duration, () => {
             RemoveStatus(BallStatus.FROZEN, frozenMat);
             GetComponent <Rigidbody2D>().isKinematic = false;
         }));
     }
 }
コード例 #17
0
ファイル: ScoreCalculator.cs プロジェクト: EternalGB/Robodoc
    public static bool ComboValid(Transform parent, Transform child)
    {
        AttachedBall childBall  = child.GetComponent <AttachedBall>();
        AttachedBall parentBall = parent.GetComponent <AttachedBall>();

        if (childBall != null && parentBall != null)
        {
            return(!FlagsHelper.IsSet(childBall.status, BallStatus.INFECTED) && !FlagsHelper.IsSet(parentBall.status, BallStatus.INFECTED) &&
                   (childBall.type == AttachedBall.BallTypeNames.BonusBall || parentBall.type == AttachedBall.BallTypeNames.BonusBall ||
                    childBall.type == parentBall.type));
        }
        else
        {
            return(false);
        }
    }
コード例 #18
0
        public static void BitMaskField <T>(ref T enumValue) where T : System.Enum
        {
            Dictionary <int, bool> toggleBools = new Dictionary <int, bool>();
            int possiableInt = System.Enum.GetValues(typeof(T)).Cast <int>().Max();

            foreach (T item in System.Enum.GetValues(typeof(T)))
            {
                int intValue = System.Convert.ToInt32(item);
                if (intValue == 0 || intValue == possiableInt)
                {
                    toggleBools.Add(intValue, object.Equals(enumValue, item));
                    continue;
                }
                toggleBools.Add(intValue, FlagsHelper.IsSet(enumValue, item));
            }
            using (var horizon = new EditorGUILayout.HorizontalScope())
            {
                foreach (T item in System.Enum.GetValues(typeof(T)))
                {
                    int intValue = System.Convert.ToInt32(item);

                    using (var check = new EditorGUI.ChangeCheckScope())
                    {
                        toggleBools[intValue] = GUILayout.Toggle(toggleBools[intValue], item.ToString(), toggleStyle);
                        if (check.changed)
                        {
                            if (intValue == 0 || intValue == possiableInt)
                            {
                                if (toggleBools[intValue])
                                {
                                    enumValue = item;
                                }
                                continue;
                            }
                            if (toggleBools[intValue])
                            {
                                FlagsHelper.Set(ref enumValue, item);
                            }
                            else
                            {
                                FlagsHelper.Unset(ref enumValue, item);
                            }
                        }
                    }
                }
            }
        }
コード例 #19
0
ファイル: CoreInput.cs プロジェクト: zachvp/puff-t-frez
    // Released
    public Direction2D GetInputReleased(Direction2D oldInput, Direction2D newInput)
    {
        var result = Direction2D.NONE;
        var check  = 1;

        for (var i = 0; i < 8 * sizeof(int); ++i)
        {
            var current = (Direction2D)(check << i);
            if (FlagsHelper.IsSet(oldInput, current) &&
                !FlagsHelper.IsSet(newInput, current))
            {
                FlagsHelper.Set(ref result, current);
            }
        }

        return(result);
    }
コード例 #20
0
        private void ReadChannel(FileData file, ChannelList curList, XmlNode node, int rowId)
        {
            var setupNode = node["Setup"] ?? throw new FileLoadException("Missing Setup XML element");
            var bcastNode = node["Broadcast"] ?? throw new FileLoadException("Missing Broadcast XML element");
            var data      = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);

            foreach (var n in new[] { setupNode, bcastNode })
            {
                foreach (XmlAttribute attr in n.Attributes)
                {
                    data.Add(attr.LocalName, attr.Value);
                }
            }

            if (!data.ContainsKey("UniqueID") || !int.TryParse(data["UniqueID"], out var uniqueId)) // UniqueId only exists in ChannelMap_105 and later
            {
                uniqueId = rowId;
            }
            var chan = new Channel(curList.SignalSource & SignalSource.AllAnalogDigitalInput, rowId, uniqueId, setupNode);

            chan.OldProgramNr = -1;
            chan.IsDeleted    = false;
            if (file.formatVersion == 1)
            {
                this.ParseChannelFormat1(data, chan);
            }
            else if (file.formatVersion == 2)
            {
                this.ParseChannelFormat2(data, chan);
            }

            if (FlagsHelper.IsSet(chan.SignalSource, SignalSource.DVBT))
            {
                chan.ChannelOrTransponder = LookupData.Instance.GetDvbtTransponder(chan.FreqInMhz).ToString();
            }
            else if (FlagsHelper.IsSet(chan.SignalSource, SignalSource.DVBC))
            {
                chan.ChannelOrTransponder = LookupData.Instance.GetDvbcChannelName(chan.FreqInMhz);
            }

            DataRoot.AddChannel(curList, chan);
        }
コード例 #21
0
ファイル: PlayerBall.cs プロジェクト: EternalGB/Robodoc
    public void GetGlooped(float duration, Material gloopMat)
    {
        if (!FlagsHelper.IsSet <BallStatus>(status, BallStatus.GLOOPED))
        {
            GetComponent <Renderer>().sharedMaterial = gloopMat;
            AddStatus(BallStatus.GLOOPED, gloopMat);
            //we make copies so the delegate we create keeps its own state

            /*
             * Material oldMat = GetComponent<SpriteRenderer>().sharedMaterial;
             * Transform trans = transform;
             * GetComponent<SpriteRenderer>().sharedMaterial = gloopMaterial;
             * StartCoroutine(Timers.Countdown(duration,() => {
             *      Debug.Log ("Resetting mat to " + oldMat.name + " " + oldMat.GetInstanceID());
             *      trans.GetComponent<SpriteRenderer>().sharedMaterial = oldMat;
             * }));
             */
            AttachedBall.AddStatusAllAttachedBalls(transform, BallStatus.GLOOPED, gloopMat);
            StartCoroutine(Timers.Countdown(duration, () => RemoveStatus(BallStatus.GLOOPED, gloopMat)));
        }
    }
コード例 #22
0
    // todo: move this to handleInput
    public void HandleUpdate(long count, float deltaTime)
    {
        // Compute state from input

        // In update, need to compute all possible physical actions the player must perform in FixedUpdate
        if (entity.collision.current.state.Below)
        {
            HandleGrounded();
        }
        else
        {
            HandleNotGrounded();
        }

        if (FlagsHelper.IsSet(state, State.CROUCH))
        {
            HandleCrouch();
        }

        // At this point, all the motor's velocity computations are complete,
        // so we can determine the motor's direction.
        ComputeDirection(entity.velocity);
    }
コード例 #23
0
ファイル: PlayerSkeleton.cs プロジェクト: zachvp/puff-t-frez
 // todo: optimize so that new case isn't needed for every new limb
 public void SetActive(Limb limbs, bool isActive)
 {
     if (FlagsHelper.IsSet(limbs, Limb.BODY))
     {
         body.entity.SetActive(isActive);
     }
     if (FlagsHelper.IsSet(limbs, Limb.FOOT))
     {
         foot.entity.SetActive(isActive);
     }
     if (FlagsHelper.IsSet(limbs, Limb.HAND))
     {
         hand.entity.SetActive(isActive);
     }
     if (FlagsHelper.IsSet(limbs, Limb.GRENADE))
     {
         grenade.entity.SetActive(isActive);
     }
     if (FlagsHelper.IsSet(limbs, Limb.COMBAT_HAND))
     {
         combatHand.entity.SetActive(isActive);
     }
 }
コード例 #24
0
        public bool ValidateServerCertificate(
            object sender,
            X509Certificate certificate,
            X509Chain chain,
            SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors == SslPolicyErrors.None)
            {
                return(true);
            }
            Response += "----- BEGIN SSL POLICY ERRORS -----";
            Response += Environment.NewLine;
            var msg = new StringBuilder();

            msg.AppendLine("Ssl Policy Errors!");
            if (FlagsHelper.IsSet(sslPolicyErrors, SslPolicyErrors.RemoteCertificateChainErrors))
            {
                msg.AppendLine("Remote certificate chain cannot be verified.");
            }
            if (FlagsHelper.IsSet(sslPolicyErrors, SslPolicyErrors.RemoteCertificateNameMismatch))
            {
                msg.AppendLine("Remote certificate name mismatch.");
            }
            if (FlagsHelper.IsSet(sslPolicyErrors, SslPolicyErrors.RemoteCertificateNotAvailable))
            {
                msg.AppendLine("Remote certificate not available.");
            }
            Response += msg.ToString();
            Response += "----- END SSL POLICY ERRORS -----" + Environment.NewLine;
            //just showing off my messagebox,
            MessageBoxResult result = FxMessageBox.Show(msg.ToString(), "Warning", MessageBoxButton.OK,
                                                        MessageBoxImage.Warning);

            //Since we are just examining the connection, return true
            //returning false will abort the connection.
            return(true);
        }
コード例 #25
0
    // Private
    private Vector2 Convert(Direction2D f)
    {
        var result = Vector2.zero;
        var set    = 1;
        var unset  = 0;

        if (FlagsHelper.IsSet(f, Direction2D.RIGHT))
        {
            result.x = set;
        }
        if (FlagsHelper.IsSet(f, Direction2D.LEFT))
        {
            result.x = -set;
        }
        if (FlagsHelper.IsSet(f, Direction2D.UP))
        {
            result.y = set;
        }
        if (FlagsHelper.IsSet(f, Direction2D.DOWN))
        {
            result.y = -set;
        }

        if (FlagsHelper.IsSet(f, Direction2D.RIGHT) &&
            FlagsHelper.IsSet(f, Direction2D.LEFT))
        {
            result.x = unset;
        }
        if (FlagsHelper.IsSet(f, Direction2D.UP) &&
            FlagsHelper.IsSet(f, Direction2D.DOWN))
        {
            result.y = unset;
        }

        return(result);
    }
コード例 #26
0
 public bool IsTraversable(AccessType travelMethod = AccessType.Walk)
 {
     return(FlagsHelper.IsSet(m_tile.AccessibleBy, travelMethod));
 }
コード例 #27
0
 public bool IsSimultaneousVertical()
 {
     return(FlagsHelper.IsSet(Flags, Direction2D.VERTICAL, Logical.AND));
 }
コード例 #28
0
    private void HandleGrounded()
    {
        var movement         = input.held.direction.Vector;
        var resolvedVelocity = entity.velocity;

        FlagsHelper.Unset(ref state, State.JUMP);
        wallJumpImpactDirection.Clear();

        // Horizontal movement.
        resolvedVelocity.x = movement.x * data.velocityHorizontalGroundMax;

        if (!FlagsHelper.IsSet(state, State.CROUCH))
        {
            if (input.held.crouch)
            {
                var newBounds      = entity.LocalScale;
                var crouchPosition = entity.Position;

                newBounds.x      *= data.boundsMultiplierCrouchX;
                newBounds.y      *= data.boundsMultiplierCrouchY;
                crouchPosition.y -= entity.LocalScale.y;

                var sizeOffset    = CoreUtilities.GetWorldSpaceSize(newBounds, entity.collider as BoxCollider2D, 0.5f).x;
                var checkDistance = newBounds.x;
                var hitLeft       = entity.Check(Constants.Directions.LEFT, checkDistance);
                var hitRight      = entity.Check(Constants.Directions.RIGHT, checkDistance);

                if (hitLeft)
                {
                    crouchPosition.x = hitLeft.point.x + sizeOffset;
                }
                if (hitRight)
                {
                    crouchPosition.x = hitRight.point.x - sizeOffset;
                }

                entity.SetLocalScale(newBounds);
                entity.SetPosition(crouchPosition);

                FlagsHelper.Set(ref state, State.CROUCH);
            }
        }

        if (!input.held.jump)
        {
            additiveJumpFrameCount = 0;
            jumpCount = 0;
        }

        // Jump
        if (input.pressed.jump)
        {
            if (jumpCount < data.jumpCountMax)
            {
                resolvedVelocity.y = data.velocityJumpImpulse;
                jumpCount++;
            }
        }

        entity.SetVelocity(resolvedVelocity);
    }
コード例 #29
0
ファイル: PlayerSkeleton.cs プロジェクト: zachvp/puff-t-frez
 // todo: this seems suboptimal
 public bool IsActive(Limb limbs, Logical mode)
 {
     return(FlagsHelper.IsSet(active, limbs, mode));
 }
コード例 #30
0
 /// <summary>
 ///     Returns the bit flag to a file attribute.
 /// </summary>
 /// <param name="attrib"></param>
 /// <returns></returns>
 public bool GetWin32Attribute(FileAttributes attrib)
 {
     return(FlagsHelper.IsSet((FileAttributes)Win32FileAttribute, attrib));
 }