コード例 #1
0
 public void UpdateCurrentDirection(Vector2 direction)
 {
     currentDirection   = direction;
     localDirectionType = GameplayUtils.GetDirectionTypeByVector2(direction);
     if (IsServer)
     {
         currentDirectionType.Value = (byte)localDirectionType;
     }
 }
コード例 #2
0
        public void FindAndSetBuildingAreaByAxes(Vector2 aimAxes)
        {
            int     tempCount   = 0;
            Vector3 tempVector3 = MovementTransform.position + (GameplayUtils.GetDirectionByAxes(CacheGameplayCameraTransform, aimAxes.x, aimAxes.y) * ConstructingBuildingEntity.buildDistance);

            switch (CurrentGameInstance.DimensionType)
            {
            case DimensionType.Dimension3D:
                tempCount = PhysicUtils.SortedRaycastNonAlloc3D(tempVector3 + (Vector3.up * 50f), Vector3.down, raycasts, 100f, CurrentGameInstance.GetBuildLayerMask());
                break;

            case DimensionType.Dimension2D:
                tempCount = PhysicUtils.SortedLinecastNonAlloc2D(tempVector3, tempVector3, raycasts2D, CurrentGameInstance.GetBuildLayerMask());
                break;
            }
            LoopSetBuildingArea(tempCount);
        }
コード例 #3
0
 public void UpdateCurrentDirection(Vector2 direction)
 {
     if (direction.magnitude > 0f)
     {
         localDirection     = direction;
         localDirectionType = GameplayUtils.GetDirectionTypeByVector2(direction);
     }
     if (IsServer && movementSecure == MovementSecure.ServerAuthoritative)
     {
         currentDirection.Value     = localDirection;
         currentDirectionType.Value = (byte)localDirectionType;
     }
     if (IsOwnerClient && movementSecure == MovementSecure.NotSecure)
     {
         CallNetFunction(NetFuncUpdateDirection, FunctionReceivers.Server, (sbyte)(localDirection.x * 100f), (sbyte)(localDirection.y * 100f));
     }
 }
コード例 #4
0
        public void FindAndSetBuildingAreaByAxes(Vector2 aimAxes)
        {
            Vector3 raycastPosition = CacheTransform.position + (GameplayUtils.GetDirectionByAxes(CacheGameplayCameraTransform, aimAxes.x, aimAxes.y) * ConstructingBuildingEntity.BuildDistance);

            LoopSetBuildingArea(physicFunctions.RaycastDown(raycastPosition, CurrentGameInstance.GetBuildLayerMask()));
        }
コード例 #5
0
 protected void NetFuncUpdateDirection(sbyte x, sbyte y)
 {
     currentDirection.Value     = new Vector2((float)x / 100f, (float)y / 100f);
     currentDirectionType.Value = (byte)GameplayUtils.GetDirectionTypeByVector2(currentDirection.Value);
 }