コード例 #1
0
        public void NotifyPlayer(long identityId)
        {
            string message;

            if (Config.NotifyDelaySeconds <= 0)
            {
                message = "Watch out! Someone bought your current location. They will be here soon!";
            }
            else
            {
                message = "Watch out! Someone bought your current location within the last " + Config.NotifyDelaySeconds.ToString("#,##0") + " seconds. They will be here soon!";
            }

            MyVisualScriptLogicProvider.ShowNotification(
                message, 10000, MyFontEnum.White, identityId);

            MyVisualScriptLogicProvider.SendChatMessage(
                message, Torch.Config.ChatName, identityId, MyFontEnum.Red);

            Log.Info("Identity " + identityId + " (" + PlayerUtils.GetPlayerNameById(identityId) + ") was Notified about their GPS being bought!");
        }
コード例 #2
0
 private LobbyServerReadyNotification LobbyServerReady(ClientConnection connection)
 {
     return(new LobbyServerReadyNotification
     {
         AccountData = PlayerUtils.GetAccountData(connection),
         AlertMissionData = new LobbyAlertMissionDataNotification(),
         CharacterDataList = DummyLobbyData.CreateCharacterDataList(),
         CommerceURL = "http://127.0.0.1/AtlasCommerce",
         EnvironmentType = EnvironmentType.External,
         FactionCompetitionStatus = new FactionCompetitionNotification(),
         FriendStatus = new FriendStatusNotification {
             FriendList = FriendListUtils.GetFriendList(connection.AccountId)
         },
         GroupInfo = new LobbyPlayerGroupInfo
         {
             SelectedQueueType = GameType.Practice,
             MemberDisplayName = connection.UserName,
             // ChararacterInfo = DummyLobbyData.CreateLobbyCharacterInfo(CharacterType.Archer),
             Members = new List <UpdateGroupMemberData>()
         },
         SeasonChapterQuests =
             new LobbySeasonQuestDataNotification
         {
             SeasonChapterQuests = new Dictionary <int, SeasonChapterQuests>()
         },
         ServerQueueConfiguration = DummyLobbyData.CreateServerQueueConfiguration(),
         Status = new LobbyStatusNotification
         {
             AllowRelogin = false,
             ServerLockState = ServerLockState.Unlocked,
             ServerMessageOverrides = new ServerMessageOverrides(),
             ClientAccessLevel = ClientAccessLevel.Full,
             HasPurchasedGame = true,
             GameplayOverrides = DummyLobbyData.CreateLobbyGameplayOverrides(),
             UtcNow = DateTime.UtcNow,
             PacificNow = DateTime.Now, // TODO: Should be pacific time
             ErrorReportRate = TimeSpan.FromMinutes(3)
         }
     });
 }
コード例 #3
0
    /// <summary>
    /// Draw buttons level on scene
    /// </summary>
    /// <returns></returns>
    IEnumerator MapButtonDrawer()
    {
        DataLoader.enableclick = false;
        MapPosD();
        processbar.fillAmount = 0.3f;
        yield return(new WaitForSeconds(0.3f));

        Debug.Log("1");
        PlayerUtils pu = new PlayerUtils();

        MyData = pu.Load();
        processbar.fillAmount = 0.5f;
        Debug.Log("2");
        yield return(new WaitForSeconds(0.3f));

        for (int i = 0; i < 20; i++)
        {
            processbar.fillAmount += 0.0016834016834017f * 3;
            insmap(mappos[i], i);
            insmap(mappos[i + 20], i + 20);
            yield return(null);
        }
        Debug.Log("3");
        processbar.transform.parent.gameObject.SetActive(false);
        DataLoader.enableclick = true;
        if (CameraMovement.StarPointMoveIndex != -1 && CameraMovement.StarPointMoveIndex != 40)
        {
            StarPointMove();
            yield return(new WaitForSeconds(STARMOVE_TIME));

            CameraMovement.mcamera.PopUpShow(MyData[CameraMovement.StarPointMoveIndex]);

            PlayerPrefs.SetFloat("LASTPOS", listmap[CameraMovement.StarPointMoveIndex].transform.position.y);
            PlayerPrefs.SetFloat("LASTPOSX", listmap[CameraMovement.StarPointMoveIndex].transform.position.x);
        }
        else
        {
            CameraMovement.mcamera.StarPoint.transform.GetChild(0).GetComponent <Animation>().Play("StarPoint");
        }
    }
コード例 #4
0
ファイル: PlayerController.cs プロジェクト: RudraNilBasu/LD42
    // Update is called once per frame
    void Update()
    {
        if (jumped && isGrounded() && ((Time.time - jumpTime) >= 0.5f))
        {
            jumped = false;
            if (cameraShake != null)
            {
                cameraShake.Shake(0.08f, 0.1f);
            }
        }

        // Movement
        float _xMov = Input.GetAxis("Horizontal") * moveSpeed;
        // float _xMov = moveSpeed; // Automove
        float _yMov = rb.velocity.y; // equals to player's current Y velocity

        if (Input.GetButton("Jump") && isGrounded())
        {
            jumped   = true;
            jumpTime = Time.time;
            // TODO: Don't jump too high
            _yMov += jumpSpeed; // initially it was jumpSpeed * -10 * time.deltatime
        }

        if (transform.position.y <= -5.0f)
        {
            PlayerUtils.Kill();
        }
        motor.move(new Vector2(_xMov, _yMov));

        // Shooting
        if (Input.GetKeyDown(KeyCode.X))
        {
            if (cameraShake != null)
            {
                cameraShake.Shake(0.1f, 0.1f);
            }
            Instantiate(bullet, playerShootPoint.transform.position, playerShootPoint.transform.rotation);
        }
    }
コード例 #5
0
        public override WWWResponse ProcessRequest(WWWRequest request)
        {
            string html     = Servers.HTTP.WWW._templates["onlineplayers"];
            string itemHtml = Servers.HTTP.WWW._templates["onlineplayersitem"];

            string itemList = "";

            foreach (EntityPlayer player in PlayerUtils.GetOnlinePlayers())
            {
                string sitem   = itemHtml;
                string steamId = PlayerUtils.GetSteamID(player.entityId.ToString());
                sitem = sitem.Replace("{steam_id}", steamId);
                sitem = sitem.Replace("{display_name}", PlayerUtils.GetDisplayName(player.entityId.ToString()));

                string playerGroupName  = "guest";
                string playerAdminLevel = "1000";

                if (SDTM.API.Permissions.Users.ContainsKey(steamId))
                {
                    playerGroupName = SDTM.API.Permissions.Users [steamId].Group;
                }

                playerAdminLevel = GameManager.Instance.adminTools.GetAdminToolsClientInfo(steamId).PermissionLevel.ToString();

                sitem = sitem.Replace("{experm_group}", playerGroupName);
                sitem = sitem.Replace("{admin_level}", playerAdminLevel);
                string itemTools = "";
                itemTools += "<a href=\"/settings/experm/user?user="******"\" title=\"Security\"><i class=\"fa fa-shield\" aria-hidden=\"true\"></i></a>";
                //itemTools+=" <a href=\"/settings/player/inventory?player="+steamId+"\" title=\"View Player Inventory\"><i class=\"fa fa-suitcase\" aria-hidden=\"true\"></i></a>";
                //itemTools+=" <a href=\"/settings/player/kick?player="+steamId+"\" title=\"Kick/Ban User\"><i class=\"fa fa-ban\" aria-hidden=\"true\"></i></a>";
                sitem     = sitem.Replace("{tools}", itemTools);
                itemList += sitem;
            }

            html = html.Replace("{player_list}", itemList);

            WWWResponse response = new WWWResponse(html);

            return(response);
        }
コード例 #6
0
    public GameObject GetNextRunnerTakingAction()
    {
        List <GameObject> availableRunnerList = GameManager.AttackTeamRunnerList
                                                .Where(attackTeamRunner => {
            RunnerBehaviour runnerBehaviour = PlayerUtils.FetchRunnerBehaviourScript(attackTeamRunner);
            return(this.IsplayerAvailable(attackTeamRunner.name) && !runnerBehaviour.IsStaying);
        })
                                                .ToList();

        int runnerCount = availableRunnerList.Count;

        if (runnerCount == 0)
        {
            return(null);
        }

        GameObject runner;

        if (CurrentRunner == null)
        {
            runner = availableRunnerList.First();
        }
        else
        {
            runner = CurrentRunner;
        }

        int runnerIndex = availableRunnerList.IndexOf(runner);

        if (runnerIndex == runnerCount - 1)
        {
            runner = availableRunnerList.First();
        }
        else
        {
            runner = availableRunnerList[runnerIndex + 1];
        }

        return(runner);
    }
コード例 #7
0
        public void Command(Edict pEntity, ICommand command)
        {
            // Is the client spawned yet?
            var player = pEntity.TryGetEntity <BasePlayer>();

            if (player == null)
            {
                return;
            }

            var commandName = command.Name;

            //TODO: implement commands

            if (commandName == PlayerUtils.SayCommandName)
            {
                PlayerUtils.HostSay(player, command, false);
            }
            else if (commandName == PlayerUtils.SayTeamCommandName)
            {
                PlayerUtils.HostSay(player, command, true);
            }
            else if (commandName == "closemenus")
            {
                // just ignore it
            }
            else if (Engine.GameRules.ClientCommand(player, command))
            {
                // MenuSelect returns true only if the command is properly handled,  so don't print a warning
            }
            else
            {
                // check the length of the command (prevents crash)
                // max total length is 192 ...and we're adding a string below ("Unknown command: %s\n")
                var printableName = commandName.Length > 127 ? commandName.Substring(0, 127) : commandName;

                // tell the user they entered an unknown command
                PlayerUtils.ClientPrint(player, HudPrint.Console, $"Unknown command: {printableName}\n");
            }
        }
コード例 #8
0
        public void ResolveTies_ReturnsPlayersWithBestHand()
        {
            string      player1Name  = "mockPlayer1";
            List <Card> player1Cards = TestUtil.CreateTestFlushCards(Suit.Club, new int[] { 13, 10, 3, 5, 4 });
            Player      player1      = new Player(player1Name, player1Cards);

            string      player2Name  = "mockPlayer2";
            List <Card> player2Cards = TestUtil.CreateTestFlushCards(Suit.Heart, new int[] { 6, 1, 3, 5, 4 });
            Player      player2      = new Player(player2Name, player2Cards);

            List <Player> players = new List <Player>
            {
                { player1 },
                { player2 }
            };

            List <Player> result = PlayerUtils.ResolveTies(players);

            Assert.AreEqual(result.Count, 1);
            Assert.AreEqual(result[0].Name, player1Name);
            Assert.AreEqual(result[0].HandOfCards.GetHandType(), HandType.Flush);
        }
コード例 #9
0
    private GameObject FilterCurrentSearchRunner(int i, List <GameObject> runnerList, int runnerListCount)
    {
        GameObject      currentSearchRunner = runnerList[i];
        RunnerBehaviour runnerBehaviour     = PlayerUtils.FetchRunnerBehaviourScript(currentSearchRunner);

        if (this.IsplayerAvailable(currentSearchRunner.name) && !runnerBehaviour.IsStaying && currentSearchRunner.activeInHierarchy)
        {
            if (i != runnerListCount - 1)
            {
                this.NextRunner = runnerList[i + 1];
            }
            else
            {
                this.NextRunner = runnerList.First();
            }

            this.CurrentRunner = currentSearchRunner;
            return(this.CurrentRunner);
        }

        return(null);
    }
コード例 #10
0
        public void GeneratePlayers_BuildsAlistOfPlayersFromGameData()
        {
            string      player1Name  = "mockPlayer1";
            List <Card> player1Cards = TestUtil.CreateDefaultThreeOfAKindCards();

            string      player2Name  = "mockPlayer2";
            List <Card> player2Cards = TestUtil.CreateDefaultPairCards();

            Dictionary <string, List <Card> > gameData = new Dictionary <string, List <Card> >
            {
                { player1Name, player1Cards },
                { player2Name, player2Cards }
            };

            List <Player> players = PlayerUtils.GeneratePlayers(gameData);

            Assert.AreEqual(players.Count, 2);
            Assert.IsNotNull(players.Find((player) => player.Name == player1Name));
            Assert.IsNotNull(players.Find((player) => player.Name == player2Name));
            Assert.AreEqual(players.Find((player) => player.Name == player1Name).HandOfCards.GetHandType(), HandType.ThreeOfAKind);
            Assert.AreEqual(players.Find((player) => player.Name == player2Name).HandOfCards.GetHandType(), HandType.Pair);
        }
コード例 #11
0
    public RunnerBehaviour ConvertBatterToRunner(PlayerStatus batterStatusScript)
    {
        PlayersTurnManager playersTurnManager = GameUtils.FetchPlayersTurnManager();
        GameObject         currentBatter      = batterStatusScript.gameObject;
        GameObject         bat             = PlayerUtils.GetPlayerBatGameObject(currentBatter);
        GameManager        gameManager     = GameUtils.FetchGameManager();
        RunnerBehaviour    runnerBehaviour = currentBatter.AddComponent <RunnerBehaviour>();

        gameManager.AttackTeamRunnerList.Add(runnerBehaviour.gameObject);
        gameManager.AttackTeamRunnerListClone.Add(runnerBehaviour.gameObject);
        gameManager.AttackTeamBatterListClone.Remove(currentBatter);
        playersTurnManager.CurrentRunner = runnerBehaviour.gameObject;
        runnerBehaviour.EquipedBat       = bat;
        bat.SetActive(false);
        Destroy(currentBatter.GetComponent <BatterBehaviour>());

        batterStatusScript.PlayerFieldPosition = PlayerFieldPositionEnum.RUNNER;
        TeamUtils.AddPlayerTeamMember(PlayerFieldPositionEnum.RUNNER, currentBatter, TeamUtils.GetBaseballPlayerOwner(currentBatter));

        int batterCount = gameManager.AttackTeamBatterListClone.Count;

        if (batterCount > 0)
        {
            GameObject nextBatter = gameManager.AttackTeamBatterListClone.First();
            gameManager.EquipBatToPlayer(nextBatter);
            TeamUtils.AddPlayerTeamMember(PlayerFieldPositionEnum.BATTER, nextBatter, TeamUtils.GetBaseballPlayerOwner(nextBatter));
        }

        string runnerNumber  = runnerBehaviour.gameObject.name.Split('_').Last();
        string newRunnerName = NameConstants.RUNNER_NAME + "_" + runnerNumber;

        runnerBehaviour.gameObject.name = newRunnerName;


        playersTurnManager.TurnState = TurnStateEnum.STANDBY;

        return(runnerBehaviour);
    }
コード例 #12
0
    /// <summary>
    /// Draw buttons level on scene
    /// </summary>
    /// <returns></returns>
    IEnumerator MapButtonDrawer()
    {
        DataLoader.enableclick = false;
        MapPosD();
        processbar.fillAmount = 0.3f;
        yield return new WaitForSeconds(0.3f);
        Debug.Log("1");
        PlayerUtils pu = new PlayerUtils();
        MyData = pu.Load();
        processbar.fillAmount = 0.5f;
        Debug.Log("2");
        yield return new WaitForSeconds(0.3f);

        for (int i = 0; i < 20; i++)
        {
            processbar.fillAmount += 0.0016834016834017f * 3;
            insmap(mappos[i], i);
            insmap(mappos[i + 20], i + 20);
            yield return null;
        }
        Debug.Log("3");
        processbar.transform.parent.gameObject.SetActive(false);
        DataLoader.enableclick = true;
        if (CameraMovement.StarPointMoveIndex != -1 && CameraMovement.StarPointMoveIndex != 40)
        {
            StarPointMove();
            yield return new WaitForSeconds(STARMOVE_TIME);
            CameraMovement.mcamera.PopUpShow(MyData[CameraMovement.StarPointMoveIndex]);

            PlayerPrefs.SetFloat("LASTPOS", listmap[CameraMovement.StarPointMoveIndex].transform.position.y);
            PlayerPrefs.SetFloat("LASTPOSX", listmap[CameraMovement.StarPointMoveIndex].transform.position.x);

        }
        else
        {
            CameraMovement.mcamera.StarPoint.transform.GetChild(0).GetComponent<Animation>().Play("StarPoint");
        }
    }
コード例 #13
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (ColliderUtils.HasBallCollided(collision) && !GameData.isPaused)
        {
            GameObject     ball = collision.gameObject;
            BallController ballControllerScript = BallUtils.FetchBallControllerScript(ball);

            if (ballControllerScript.IsHit)
            {
                timeElapsed += Time.deltaTime;

                if (timeElapsed >= TIME_TO_WAIT_IN_FOUL_ZONE)
                {
                    Debug.Log("the ball is foul");
                    timeElapsed = 0;

                    DialogBoxManager dialogBoxManagerScript = GameUtils.FetchDialogBoxManager();
                    dialogBoxManagerScript.DisplayDialogAndTextForGivenAmountOfTime(1f, false, "FOUL!!");
                    PlayersTurnManager playersTurnManager     = GameUtils.FetchPlayersTurnManager();
                    GameObject         pitcher                = TeamUtils.GetPlayerTeamMember(PlayerFieldPositionEnum.PITCHER, TeamUtils.GetPlayerIdFromPlayerFieldPosition(PlayerFieldPositionEnum.PITCHER));
                    GameManager        gameManager            = GameUtils.FetchGameManager();
                    GameObject         currentBatter          = gameManager.AttackTeamBatterListClone.First();
                    BatterBehaviour    currentBatterBehaviour = PlayerUtils.FetchBatterBehaviourScript(currentBatter);
                    GameObject         bat = currentBatterBehaviour.EquipedBat;
                    currentBatterBehaviour.FoulOutcomeCount += 1;
                    currentBatter.transform.rotation         = Quaternion.identity;
                    bat.transform.position = FieldUtils.GetBatCorrectPosition(currentBatter.transform.position);
                    bat.transform.rotation = Quaternion.Euler(0f, 0f, -70f);
                    gameManager.ReinitPitcher(pitcher);
                    gameManager.ReturnBallToPitcher(ballControllerScript.gameObject);
                    gameManager.ReinitRunners(gameManager.AttackTeamRunnerList);
                    ballControllerScript.IsInFoulState = false;
                    playersTurnManager.TurnState       = TurnStateEnum.PITCHER_TURN;
                    PlayersTurnManager.IsCommandPhase  = true;
                }
            }
        }
    }
コード例 #14
0
    public void CalculateFielderColliderInterraction(GameObject ballGameObject, BallController ballControllerScript, GenericPlayerBehaviour genericPlayerBehaviourScript)
    {
        float passSuccessRate;

        if (ballControllerScript.IsPassed)
        {
            passSuccessRate = ActionCalculationUtils.CalculatePassSuccessRate(this.gameObject, ballControllerScript.CurrentHolder, ballControllerScript.BallHeight);
        }
        else
        {
            passSuccessRate = 100f;
        }

        if (ActionCalculationUtils.HasActionSucceeded(passSuccessRate))
        {
            PlayerActionsManager.InterceptBall(ballGameObject, ballControllerScript, genericPlayerBehaviourScript);
            PlayerStatus       fielderStatus      = PlayerUtils.FetchPlayerStatusScript(this.gameObject);
            PlayersTurnManager playersTurnManager = GameUtils.FetchPlayersTurnManager();
            playersTurnManager.TurnState = TurnStateEnum.FIELDER_TURN;
            playersTurnManager.CurrentFielderTypeTurn = fielderStatus.PlayerFieldPosition;
            PlayersTurnManager.IsCommandPhase         = true;
        }
    }
コード例 #15
0
 public static void SendToAll(GameObject subjectPlayer, PlayerState state)
 {
     if (PlayerUtils.IsGhost(subjectPlayer))
     {
         //Send ghost positions only to ghosts
         foreach (var connectedPlayer in PlayerList.Instance.InGamePlayers)
         {
             if (PlayerUtils.IsGhost(connectedPlayer.GameObject))
             {
                 Send(connectedPlayer.GameObject, subjectPlayer, state);
             }
         }
     }
     else
     {
         var msg = new PlayerMoveMessage
         {
             SubjectPlayer = subjectPlayer != null?subjectPlayer.GetComponent <NetworkIdentity>().netId : NetworkInstanceId.Invalid,
             State         = state,
         };
         msg.SendToAll();
     }
 }
コード例 #16
0
    public bool IsValid(SpawnSessionContext context)
    {
        if (RequiredValue <= 0)
        {
            return(true);
        }

        if (SearchDistance <= 0)
        {
            return(true);
        }

        List <Player> players = PlayerUtils.GetPlayersInRadius(context.SpawnerZdo.GetPosition(), SearchDistance);

        var valueSum = 0;

        foreach (var player in players)
        {
            if (player.IsNull())
            {
                continue;
            }

            var items = player.GetInventory()?.GetAllItems() ?? Enumerable.Empty <ItemDrop.ItemData>();

#if DEBUG && VERBOSE
            Log.LogTrace($"Player '{player.m_name}': {items.Join(x => x.m_shared?.m_name)}");
#endif

            foreach (var item in items)
            {
                valueSum += item?.GetValue() ?? 0;
            }
        }

        return(valueSum >= RequiredValue);
    }
コード例 #17
0
        public void Play(IEnumerable <Player> players)
        {
            var playersRing   = new LinkedList <Player>(players);
            var currentPlayer = playersRing.First;

            // Play as long as at least two players are alive
            while (playersRing.Count(p => !p.IsPlayerDead) > 1)
            {
                // Print game status
                PlayerUtils.PrintPlayers(playersRing);
                Console.WriteLine();

                if (currentPlayer.Value.MultiPlayerBangStrategy != null)
                {
                    // BangMultiPlayer returns the player that was shot at (victim)
                    var victim = BangMultiPlayer(currentPlayer.Value, GetAliveVictims(currentPlayer).ToList());

                    // Find the victim in the players ring
                    var victimPlayer = playersRing.Find(victim);

                    // If victim was killed
                    currentPlayer = victim.IsPlayerDead ? GetNextAlivePlayer(victimPlayer) : victimPlayer;
                }
                else
                {
                    // Current player shoots at next alive player in line
                    Bang(currentPlayer.Value, GetNextAlivePlayer(currentPlayer).Value);

                    // Set next alive player to current (important to calculate next alive player again here
                    // because the previous next alive player might have been killed by the bang above)
                    currentPlayer = GetNextAlivePlayer(currentPlayer);
                }
            }

            PlayerUtils.PrintPlayers(playersRing);
            Console.WriteLine("Game over");
        }
コード例 #18
0
        public string CreatePathForPlayer(string path, long playerId)
        {
            string folderName;

            if (Config.UseSteamId)
            {
                ulong steamId = MySession.Static.Players.TryGetSteamId(playerId);

                folderName = steamId.ToString();
            }
            else
            {
                folderName = playerId.ToString();
            }

            if (Config.PlayerNameOnFolders)
            {
                /*
                 * Usually all calling locations could deal with a MyIdentity instead.
                 * But I dont want to deal with NULL values to get Nobody Grids exported.
                 */
                string playerName = PlayerUtils.GetPlayerNameById(playerId);

                foreach (var c in Path.GetInvalidFileNameChars())
                {
                    playerName = playerName.Replace(c, '_');
                }

                folderName = playerName + "_" + folderName;
            }

            var folder = Path.Combine(path, folderName);

            Directory.CreateDirectory(folder);

            return(folder);
        }
コード例 #19
0
    public void StayOnCurrentBase()
    {
        Debug.Log(this.name + " wait on current base");
        this.IsStaying = true;
        PlayersTurnManager playersTurnManager = GameUtils.FetchPlayersTurnManager();

        playersTurnManager.UpdatePlayerTurnAvailability(this.gameObject.name, TurnAvailabilityEnum.WAITING);
        IsoRenderer.ReinitializeAnimator();

        GameManager gameManager = GameUtils.FetchGameManager();

        bool isRunnersAllSafeAndStaying = gameManager.AttackTeamRunnerList.TrueForAll(runner => {
            RunnerBehaviour runnerBehaviour = PlayerUtils.FetchRunnerBehaviourScript(runner);
            return(runnerBehaviour.IsSafe && runnerBehaviour.IsStaying);
        });

        //test if all remaining runner are out and there no more batters
        int runnersCount = gameManager.AttackTeamRunnerList.Count;
        int batterCount  = gameManager.AttackTeamBatterListClone.Count;

        if (runnersCount == 0 && batterCount == 0 || batterCount == 0 && runnersCount > 0 && isRunnersAllSafeAndStaying)
        {
            gameManager.IsStateCheckAllowed = false;
            gameManager.ProcessNextInningHalf();
            return;
        }
        else if (isRunnersAllSafeAndStaying)
        {
            playersTurnManager.IsRunnersTurnsDone = true;
        }

        Vector3 nextBasePosition = this.GetNextBasePosition(this.CurrentBase);

        IsoRenderer.LookAtFieldElementAnimation(nextBasePosition);

        this.CalculateNextAction();
    }
コード例 #20
0
ファイル: JumpState.cs プロジェクト: NoctisRB/Eddy
    public override void Update()
    {
        currentTime += Time.deltaTime;
        var vector3D = PlayerUtils.RetargetVector(_controller.movementVector, _controller.cameraTransform, _controller.joystickDeadZone);

        _controller.RotateTowardsForward(vector3D);

        if (!UIManager.Instance.popUpEnabled)
        {
            vector3D *= Mathf.Lerp(_controller.minSpeed, _controller.maxSpeed, _controller.movementVector.magnitude);
        }
        else
        {
            vector3D *= _controller.minSpeed;
        }

        if (_controller.edgeAvailable && PlayerUtils.CanInteractWithEdge(_controller.transform.forward, _controller.edgeGameObject.transform.forward, _controller.angleToAllowClimbEdge))
        {
            ExitState();
        }

        _controller.verticalSpeed += Physics.gravity.y * Time.deltaTime * _controller.gravityMultiplier;
        vector3D.y = _controller.verticalSpeed;

        vector3D.x = vector3D.x * _controller.speedMultiplierWhenJump;
        vector3D.z = vector3D.z * _controller.speedMultiplierWhenJump;
        vector3D  += CheckResidualCollisions();

        _controller.characterController.Move(vector3D * Time.deltaTime);

        if (CheckFloor(PlayerUtils.GetFloorColliders(_controller, _controller.feetOverlap.position)))
        {
            _controller.LandingSound();
            ExitState();
        }
    }
コード例 #21
0
    // ---------------------------------------------------------------------------------
    // CHARACTER CONTROLS
    // ---------------------------------------------------------------------------------

    // Design flaw - player can walk off ledge, falling won't trigger until the player "jumps"
    // Rework required
    private IEnumerator Jump()
    {
        bool isFalling = false;

        // Start jump
        isJumping = true;
        yield return(StartCoroutine(JumpAnimation()));

        rigBody.AddForce(Vector3.up * jumpHeight, ForceMode.VelocityChange);

        // Wait until falling
        while (!isFalling)
        {
            yield return(new WaitForSeconds(0.5f));

            if (!PlayerUtils.CharacterFalling(lastYposition, transform.position.y))
            {
                isJumping = true;
                isFalling = true;
            }
        }

        StartCoroutine(FallAnimation());
    }
コード例 #22
0
ファイル: CombatState.cs プロジェクト: NoctisRB/Eddy
    public override void Update()
    {
        _currentTime += Time.deltaTime;
        if (_exitWhenFinished && _currentTime >= _timeToExitState)
        {
            ExitState();
        }

        if (_combatController.GetState().GetType() == typeof(AreaAttackState))
        {
            var vector3D = PlayerUtils.RetargetVector(_controller.movementVector, _controller.cameraTransform, _controller.joystickDeadZone);
            vector3D  *= Mathf.Lerp(_controller.minSpeed, _controller.maxSpeed, _controller.movementVector.magnitude);
            vector3D.y = _controller.characterController.velocity.y + Physics.gravity.y * Time.deltaTime;
            _controller.characterController.Move(vector3D * Time.deltaTime);
        }

        if (_combatController.target && _combatController.target.healthPoints > 0 && GetAngleBetweenPlayerAndTarget() > 5)
        {
            Vector3 targetDirection = (_combatController.target.transform.position - _controller.transform.position).normalized;
            targetDirection = Vector3.ProjectOnPlane(targetDirection, Vector3.up);
            Vector3 newDirection = Vector3.RotateTowards(_controller.transform.forward, targetDirection, 2 * Time.deltaTime, 0);
            _controller.transform.rotation = Quaternion.LookRotation(newDirection);
        }
    }
コード例 #23
0
ファイル: MoveState.cs プロジェクト: NoctisRB/Eddy
    public override void Update()
    {
        if (UIManager.Instance.paused || _controller.dontMove)
        {
            _controller.animator.SetFloat("Speed", 0);
            return;
        }

        vector3D = PlayerUtils.RetargetVector(_controller.movementVector, _controller.cameraTransform, _controller.joystickDeadZone);
        _controller.RotateTowardsForward(vector3D);

        if (UIHelperController.Instance.actionsToComplete.Contains(UIHelperController.HelperAction.Move) && _controller.movementVector.magnitude >= 0.7f)
        {
            UIHelperController.Instance.EnableHelper(UIHelperController.HelperAction.Jump, _controller.transform.position + Vector3.up * 2, _controller.transform);
            UIHelperController.Instance.DisableHelper(UIHelperController.HelperAction.Move);
        }

        if (!UIManager.Instance.popUpEnabled)
        {
            vector3D *= Mathf.Lerp(_controller.minSpeed, _controller.maxSpeed, _controller.movementVector.magnitude);
        }
        else
        {
            vector3D *= _controller.minSpeed;
        }

        SnapToFloor();

        if (!_controller.combatController.nextAttackReserved)
        {
            _controller.characterController.Move(vector3D * Time.deltaTime + verticalSnap);
            _controller.animator.SetFloat("Speed", vector3D.magnitude);
        }

        ExitState();
    }
コード例 #24
0
        // Token: 0x06000AE9 RID: 2793 RVA: 0x00003D42 File Offset: 0x00001F42
        private IEnumerator Check()
        {
            yield return(new WaitForSeconds(10f));

            PlayerUtils.inWorld();
            foreach (Player player in PlayerManager.GetAllPlayers())
            {
                try
                {
                    APIUser user = player.HGLCOLNAJJJ;
                    if (VRCPlayer.AreNameplatesVisible() && (player.GetAPIUser().id == "usr_5d6d5cdb-5ad3-4452-81ac-831573e30c0a" || player.GetAPIUser().id == "usr_f5986dff-c03d-435d-a83d-d19369782b61" || player.GetAPIUser().id == "usr_46cadc1c-4d14-4403-ad75-24e39e6580f1" || player.GetAPIUser().id == "thenew"))
                    {
                        player.vrcPlayer.SetNamePlateColor(UnityEngine.Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f));
                        UnityEngine.Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
                        player.vrcPlayer.namePlate.mainText.text = "<color=green>TurtleGangMember</color><color=white>" + user.displayName + "</color>";
                        //player.vrcPlayer.playerSelector.transform.
                    }
                }
                catch
                {
                }
            }
            yield break;
        }
コード例 #25
0
        protected override void Client_PacketReceived(Packet packet)
        {
            base.Client_PacketReceived(packet);

            if (packet.Type == PacketType.PlaySong)
            {
                PlaySong playSong = packet.SpecificPacket as PlaySong;

                var desiredLevel          = SongUtils.masterLevelList.First(x => x.levelID == playSong.GameplayParameters.Beatmap.LevelId);
                var desiredCharacteristic = desiredLevel.previewDifficultyBeatmapSets.FirstOrDefault(x => x.beatmapCharacteristic.serializedName == playSong.GameplayParameters.Beatmap.Characteristic.SerializedName).beatmapCharacteristic ?? desiredLevel.previewDifficultyBeatmapSets.First().beatmapCharacteristic;
                var desiredDifficulty     = (BeatmapDifficulty)playSong.GameplayParameters.Beatmap.Difficulty;

                var playerData     = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First().playerData;
                var playerSettings = playerData.playerSpecificSettings;

                //Override defaults if we have forced options enabled
                if (playSong.GameplayParameters.PlayerSettings.Options != PlayerOptions.None)
                {
                    playerSettings = new PlayerSpecificSettings(
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.StaticLights),
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.LeftHanded),
                        playSong.GameplayParameters.PlayerSettings.PlayerHeight,
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AutoPlayerHeight),
                        playSong.GameplayParameters.PlayerSettings.SfxVolume,
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.ReduceDebris),
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.NoHud),
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.NoFailEffects),
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AdvancedHud),
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AutoRestart),
                        playSong.GameplayParameters.PlayerSettings.SaberTrailIntensity,
                        playSong.GameplayParameters.PlayerSettings.NoteJumpStartBeatOffset,
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.HideNoteSpawnEffect),
                        playSong.GameplayParameters.PlayerSettings.Options.HasFlag(PlayerOptions.AdaptiveSfx)
                        );
                }

                var songSpeed = GameplayModifiers.SongSpeed.Normal;
                if (playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.SlowSong))
                {
                    songSpeed = GameplayModifiers.SongSpeed.Slower;
                }
                if (playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.FastSong))
                {
                    songSpeed = GameplayModifiers.SongSpeed.Faster;
                }

                var gameplayModifiers = new GameplayModifiers(
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.DemoNoFail),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.DemoNoObstacles),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.BatteryEnergy) ? GameplayModifiers.EnergyType.Battery : GameplayModifiers.EnergyType.Bar,
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoFail),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.InstaFail),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.FailOnClash),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoObstacles) ? GameplayModifiers.EnabledObstacleType.NoObstacles : GameplayModifiers.EnabledObstacleType.All,
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoBombs),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.FastNotes),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.StrictAngles),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.DisappearingArrows),
                    songSpeed,
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.NoArrows),
                    playSong.GameplayParameters.GameplayModifiers.Options.HasFlag(GameOptions.GhostNotes)
                    );

                var colorScheme = playerData.colorSchemesSettings.overrideDefaultColors ? playerData.colorSchemesSettings.GetSelectedColorScheme() : null;

                //Disable score submission if nofail is on. This is specifically for Hidden Sabers, though it may stay longer
                if (playSong.DisableScoresaberSubmission)
                {
                    BS_Utils.Gameplay.ScoreSubmission.DisableSubmission(SharedConstructs.Name);
                }
                if (playSong.ShowNormalNotesOnStream)
                {
                    var customNotes = IPA.Loader.PluginManager.GetPluginFromId("CustomNotes");
                    if (customNotes != null)
                    {
                        EnableHMDOnly();
                    }
                }

                PlaySong?.Invoke(desiredLevel, desiredCharacteristic, desiredDifficulty, gameplayModifiers, playerSettings, playerData.overrideEnvironmentSettings, colorScheme, playSong.FloatingScoreboard, playSong.StreamSync, playSong.DisablePause, playSong.DisableFail);
            }
            else if (packet.Type == PacketType.Command)
            {
                Command command = packet.SpecificPacket as Command;
                if (command.CommandType == Command.CommandTypes.ReturnToMenu)
                {
                    if (SyncHandler.Instance != null)
                    {
                        ScreenOverlay.Instance.Clear();
                    }
                    if ((Self as Player).PlayState == Player.PlayStates.InGame)
                    {
                        PlayerUtils.ReturnToMenu();
                    }
                }
                else if (command.CommandType == Command.CommandTypes.ScreenOverlay_ShowPng)
                {
                    ScreenOverlay.Instance.ShowPng();
                }
                else if (command.CommandType == Command.CommandTypes.DelayTest_Finish)
                {
                    UnityMainThreadDispatcher.Instance().Enqueue(() => {
                        ScreenOverlay.Instance.Clear();
                        SyncHandler.Instance.Resume();
                        SyncHandler.Destroy();
                    });
                }
            }
            else if (packet.Type == PacketType.LoadSong)
            {
                LoadSong loadSong = packet.SpecificPacket as LoadSong;

                Action <IBeatmapLevel> SongLoaded = (loadedLevel) =>
                {
                    //Send updated download status
                    (Self as Player).DownloadState = Player.DownloadStates.Downloaded;

                    var playerUpdate = new Event();
                    playerUpdate.Type          = Event.EventType.PlayerUpdated;
                    playerUpdate.ChangedObject = Self;
                    Send(new Packet(playerUpdate));

                    //Notify any listeners of the client that a song has been loaded
                    LoadedSong?.Invoke(loadedLevel);
                };

                if (OstHelper.IsOst(loadSong.LevelId))
                {
                    SongLoaded?.Invoke(SongUtils.masterLevelList.First(x => x.levelID == loadSong.LevelId) as BeatmapLevelSO);
                }
                else
                {
                    if (SongUtils.masterLevelList.Any(x => x.levelID == loadSong.LevelId))
                    {
                        SongUtils.LoadSong(loadSong.LevelId, SongLoaded);
                    }
                    else
                    {
                        Action <string, bool> loadSongAction = (hash, succeeded) =>
                        {
                            if (succeeded)
                            {
                                SongUtils.LoadSong(loadSong.LevelId, SongLoaded);
                            }
                            else
                            {
                                (Self as Player).DownloadState = Player.DownloadStates.DownloadError;

                                var playerUpdated = new Event();
                                playerUpdated.Type          = Event.EventType.PlayerUpdated;
                                playerUpdated.ChangedObject = Self;

                                Send(new Packet(playerUpdated));
                            }
                        };

                        (Self as Player).DownloadState = Player.DownloadStates.Downloading;

                        var playerUpdate = new Event();
                        playerUpdate.Type          = Event.EventType.PlayerUpdated;
                        playerUpdate.ChangedObject = Self;
                        Send(new Packet(playerUpdate));

                        SongDownloader.DownloadSong(loadSong.LevelId, songDownloaded: loadSongAction, downloadProgressChanged: (hash, progress) => Logger.Debug($"DOWNLOAD PROGRESS ({hash}): {progress}"), customHostUrl: loadSong.CustomHostUrl);
                    }
                }
            }
            else if (packet.Type == PacketType.File)
            {
                File file = packet.SpecificPacket as File;
                if (file.Intent == File.Intentions.SetPngToShowWhenTriggered)
                {
                    var pngBytes = file.Compressed ? CompressionUtils.Decompress(file.Data) : file.Data;
                    ScreenOverlay.Instance.SetPngBytes(pngBytes);
                }
                else if (file.Intent == File.Intentions.ShowPngImmediately)
                {
                    var pngBytes = file.Compressed ? CompressionUtils.Decompress(file.Data) : file.Data;
                    ScreenOverlay.Instance.SetPngBytes(pngBytes);
                    ScreenOverlay.Instance.ShowPng();
                }

                Send(packet.From, new Packet(new Acknowledgement()
                {
                    PacketId = packet.Id,
                    Type     = Acknowledgement.AcknowledgementType.FileDownloaded
                }));
            }
        }
コード例 #26
0
ファイル: EdgeState.cs プロジェクト: NoctisRB/Eddy
    public override void Update()
    {
        if (_controller.standing || autoStand)
        {
            return;
        }

        //Puts player on grab position.
        //This will only be used on hang on edge.
        if (_controller.onEdge && !_controller.standing)
        {
            var     position   = _controller.transform.position;
            Vector3 moveVector = Vector3.zero;
            Vector3 lVector    = Vector3.Lerp(position, _controller.edgePosition + _projectedVector + PlayerUtils.GetEdgeOffsetOnLocalSpace(_controller.edgeGameObject, _controller.edgeOffset), _controller.lerpVelocity);

            moveVector = lVector - position;

            if (_controller.characterController.enabled)
            {
                _controller.characterController.Move(moveVector);
            }
        }

        if (PlayerUtils.InputEqualVector(-_controller.edgeGameObject.transform.forward, _controller.cameraTransform, _controller.movementVector) && !_controller.standing || _controller.inputToStand && !_controller.standing)
        {
            _controller.animator.SetTrigger("Climb");
            _controller.StandDeactivatePlayer();
        }
        if (PlayerUtils.InputEqualVector(_controller.edgeGameObject.transform.forward, _controller.cameraTransform, _controller.movementVector) && !_controller.standing)
        {
            _controller.onEdge        = false;
            _controller.edgeAvailable = false;
            ExitState();
        }
    }
コード例 #27
0
        public static void PatchOnDestroyRequest(MyCubeBlock __instance)
        {
            MyCubeBlock block = __instance;

            if (block as MyTerminalBlock == null)
            {
                return;
            }

            MyCubeGrid grid = block.CubeGrid;

            string gridName = grid.DisplayName;

            string oldOwnerName = PlayerUtils.GetPlayerNameById(block.OwnerId);

            bool   isOnline     = PlayerUtils.isOnline(block.OwnerId);
            string onlineString = "[Off]";

            if (isOnline)
            {
                onlineString = "[On]";
            }

            string oldFactionTag = PlayerUtils.GetFactionTagStringForPlayer(block.OwnerId);
            string oldName       = oldOwnerName + " " + onlineString + oldFactionTag;
            string causeName     = "[Unknown]";

            ChangingEntity cause          = OwnershipLoggerPlugin.Instance.DamageCache.Get(block.EntityId);
            string         additionalInfo = null;

            if (cause != null)
            {
                additionalInfo = cause.AdditionalInfo;

                if (!cause.IsPlanet)
                {
                    long causeId;

                    if (cause.Controller != 0L)
                    {
                        causeId = cause.Controller;
                    }
                    else
                    {
                        causeId = cause.Owner;
                    }

                    /* Can be offline when weapons are the cause */
                    bool   isCauseOnline     = PlayerUtils.isOnline(causeId);
                    string causeOnlineString = "[Off]";
                    if (isCauseOnline)
                    {
                        causeOnlineString = "[On]";
                    }

                    string causePlayerName = PlayerUtils.GetPlayerNameById(causeId);
                    string causeFactionTag = PlayerUtils.GetFactionTagStringForPlayer(causeId);

                    causeName = (causePlayerName + " " + causeOnlineString + causeFactionTag).PadRight(25) + " with " + cause.ChangingCause;
                }
                else
                {
                    causeName = "Planet".PadRight(25) + " with " + cause.ChangingCause;
                }
            }

            string blockpairName = block.BlockDefinition.BlockPairName;

            blockpairName = ChangeName(additionalInfo, blockpairName);

            string location = GetLocationWhenNeeded(block);

            Log.Info(causeName.PadRight(45) + " destroyed block        " + blockpairName.PadRight(20) + " from " + oldName.PadRight(25) + "    " + "".PadRight(20) + " of grid: " + gridName + location);
        }
コード例 #28
0
        public static bool PatchOnChangeOwnersRequest(List <MyCubeGrid.MySingleOwnershipRequest> requests, long requestingPlayer)
        {
            StringBuilder sb = new StringBuilder();

            /* No Requests nothing to do */
            if (requests == null)
            {
                return(true);
            }

            string resquesterName    = PlayerUtils.GetPlayerNameById(requestingPlayer);
            string requestFactionTag = PlayerUtils.GetFactionTagStringForPlayer(requestingPlayer);

            /* Dont want to print the grid information over and over again. */
            bool first = true;

            foreach (MyCubeGrid.MySingleOwnershipRequest request in requests)
            {
                MyCubeBlock block = MyEntities.GetEntityById(request.BlockId, false) as MyCubeBlock;

                /* No block found, or different ownership? */
                if (block == null)
                {
                    continue;
                }

                /* No Grid? unlikely but ignore */
                MyCubeGrid grid = block.CubeGrid;
                if (grid == null)
                {
                    continue;
                }

                string gridName = grid.DisplayName;

                string oldOwnerName = PlayerUtils.GetPlayerNameById(block.OwnerId);
                string newOwnerName = PlayerUtils.GetPlayerNameById(request.Owner);

                if (oldOwnerName == newOwnerName)
                {
                    return(true);
                }

                bool   isOnline     = PlayerUtils.isOnline(block.OwnerId);
                string onlineString = "[Off]";
                if (isOnline)
                {
                    onlineString = "[On]";
                }

                string oldFactionTag = PlayerUtils.GetFactionTagStringForPlayer(block.OwnerId);
                string newFactionTag = PlayerUtils.GetFactionTagStringForPlayer(request.Owner);

                string oldName = oldOwnerName + " " + onlineString + oldFactionTag;
                string newName = newOwnerName + " " + newFactionTag;

                string location = GetLocationWhenNeeded(block);

                /* Opening statement */
                if (first)
                {
                    sb.AppendLine("Player " + resquesterName + " " + requestFactionTag + " requested the following ownership changes on grid: '" + gridName + "'");

                    first = false;
                }

                sb.AppendLine("   block " + block.BlockDefinition.BlockPairName.PadRight(20) + " from " + oldName.PadRight(25) + " to " + newName.PadRight(20) + location);
            }

            Log.Info(sb);

            return(true);
        }
コード例 #29
0
        public static bool PatchChangeOwnerRequest(
            MyCubeGrid grid,
            MyCubeBlock block,
            long playerId,
            MyOwnershipShareModeEnum shareMode)
        {
            string gridName = grid.DisplayName;

            string oldOwnerName = PlayerUtils.GetPlayerNameById(block.OwnerId);
            string newOwnerName = PlayerUtils.GetPlayerNameById(playerId);

            /* Only shared mode was changed */
            if (oldOwnerName == newOwnerName)
            {
                return(true);
            }

            bool   isOnline     = PlayerUtils.isOnline(block.OwnerId);
            string onlineString = "[Off]";

            if (isOnline)
            {
                onlineString = "[On]";
            }

            string oldFactionTag = PlayerUtils.GetFactionTagStringForPlayer(block.OwnerId);
            string newFactionTag = PlayerUtils.GetFactionTagStringForPlayer(playerId);

            string oldName = oldOwnerName + " " + onlineString + oldFactionTag;
            string newName = newOwnerName + " " + newFactionTag;

            string causeName = "[Unknown]";

            ChangingEntity cause = OwnershipLoggerPlugin.Instance.DamageCache.Get(block.EntityId);

            string additionalInfo = null;

            if (playerId == 0L && cause != null)
            {
                additionalInfo = cause.AdditionalInfo;

                if (!cause.IsPlanet)
                {
                    long causeId;

                    if (cause.Controller != 0L)
                    {
                        causeId = cause.Controller;
                    }
                    else
                    {
                        causeId = cause.Owner;
                    }

                    /* Can be offline when weapons are the cause */
                    bool   isCauseOnline     = PlayerUtils.isOnline(causeId);
                    string causeOnlineString = "[Off]";
                    if (isCauseOnline)
                    {
                        causeOnlineString = "[On]";
                    }

                    string causePlayerName = PlayerUtils.GetPlayerNameById(causeId);
                    string causeFactionTag = PlayerUtils.GetFactionTagStringForPlayer(causeId);

                    causeName = (causePlayerName + " " + causeOnlineString + causeFactionTag).PadRight(25) + " with " + cause.ChangingCause;
                }
                else
                {
                    causeName = "Planet".PadRight(25) + " with " + cause.ChangingCause;
                }
            }
            else if (playerId != 0L)
            {
                /* Can be offline when weapons are the cause */
                bool   isCauseOnline     = PlayerUtils.isOnline(playerId);
                string causeOnlineString = "[Off]";
                if (isCauseOnline)
                {
                    causeOnlineString = "[On]";
                }

                /* Must be Online then */
                causeName = newOwnerName + " " + causeOnlineString + newFactionTag;
            }

            string blockpairName = block.BlockDefinition.BlockPairName;

            blockpairName = ChangeName(additionalInfo, blockpairName);

            string location = GetLocationWhenNeeded(block);

            Log.Info(causeName.PadRight(45) + " changed owner on block " + blockpairName.PadRight(20) + " from " + oldName.PadRight(25) + " to " + newName.PadRight(20) + " on grid: " + gridName + location);

            return(true);
        }
コード例 #30
0
    public void CalculatePitcherColliderInterraction(GameObject ballGameObject, BallController ballControllerScript, GenericPlayerBehaviour genericPlayerBehaviourScript)
    {
        int runnersOnFieldCount   = -1;
        List <GameObject> runners = PlayerUtils.GetRunnersOnField();

        runnersOnFieldCount = runners.Count;

        if (runnersOnFieldCount < 1)
        {
            return;
        }

        //Choose the runner who just hit the ball
        GameObject runnerToGetOut = runners.Last();

        bool hasIntercepted = false;
        PlayersTurnManager playersTurnManager = GameUtils.FetchPlayersTurnManager();

        if (ballControllerScript.BallHeight == BallHeightEnum.HIGH || ballControllerScript.BallHeight == BallHeightEnum.LOW)
        {
            GameManager      gameManager            = GameUtils.FetchGameManager();
            DialogBoxManager dialogBoxManagerScript = GameUtils.FetchDialogBoxManager();
            dialogBoxManagerScript.DisplayDialogAndTextForGivenAmountOfTime(1f, false, "TAG OUT !!!!!!!");

            ballControllerScript.Target = null;


            PlayerActionsManager.InterceptBall(ballGameObject, ballControllerScript, genericPlayerBehaviourScript);
            hasIntercepted = true;

            gameManager.AttackTeamRunnerList.Remove(runnerToGetOut);
            runnerToGetOut.SetActive(false);
            playersTurnManager.UpdatePlayerTurnQueue(runnerToGetOut);
            gameManager.AttackTeamBatterListClone.First().SetActive(true);
            RunnerBehaviour runnerBehaviourScript = PlayerUtils.FetchRunnerBehaviourScript(runnerToGetOut);
            BatterBehaviour batterBehaviourScript = PlayerUtils.FetchBatterBehaviourScript(gameManager.AttackTeamBatterListClone.First());
            batterBehaviourScript.EquipedBat = runnerBehaviourScript.EquipedBat;
            runnerBehaviourScript.EquipedBat = null;

            if (runnersOnFieldCount == 1)
            {
                GameData.isPaused = true;
                StartCoroutine(gameManager.WaitAndReinit(dialogBoxManagerScript, PlayerUtils.FetchPlayerStatusScript(gameManager.AttackTeamBatterListClone.First()), FieldBall));
                return;
            }
            else
            {
                GameObject bat = batterBehaviourScript.EquipedBat;
                bat.transform.SetParent(null);
                bat.transform.position = FieldUtils.GetBatCorrectPosition(batterBehaviourScript.transform.position);
                bat.transform.rotation = Quaternion.Euler(0f, 0f, -70f);
                bat.transform.SetParent(gameManager.AttackTeamBatterListClone.First().transform);
                batterBehaviourScript.EquipedBat.SetActive(true);
                TeamUtils.AddPlayerTeamMember(PlayerFieldPositionEnum.BATTER, batterBehaviourScript.gameObject, TeamUtils.GetBaseballPlayerOwner(batterBehaviourScript.gameObject));
            }
        }

        if (runnersOnFieldCount >= 1)
        {
            if (!hasIntercepted)
            {
                PlayerActionsManager.InterceptBall(ballGameObject, ballControllerScript, genericPlayerBehaviourScript);
            }

            PlayerActionsManager playerActionsManager = GameUtils.FetchPlayerActionsManager();
            PlayerAbilities      playerAbilities      = PlayerUtils.FetchPlayerAbilitiesScript(this.gameObject);
            playerAbilities.ReinitAbilities();
            PlayerAbility passPlayerAbility = new PlayerAbility("Pass to fielder", AbilityTypeEnum.BASIC, AbilityCategoryEnum.NORMAL, playerActionsManager.GenericPassAction, this.gameObject, true);
            playerAbilities.AddAbility(passPlayerAbility);
            playersTurnManager.TurnState      = TurnStateEnum.PITCHER_TURN;
            PlayersTurnManager.IsCommandPhase = true;
        }
    }
コード例 #31
0
    public void OnGUI()
    {
        if (RoomManagerBase.currentRoom != null)
        {
            int i = 0;
            PlayerManager.GetAllPlayers().ToList().ForEach(p => GUI.Label(new Rect(1, i++ *15, 300, 20), string.Format("{0}", GetAPIUser(p).displayName)));

            if (pikgui == true)
            {
                float uix = Screen.width * 0.1f;
                float uiy = Screen.height * 0.1f;
                GUI.Box(new Rect(uix, uiy, Screen.width * 0.8f, Screen.height * 0.8f), "Pik hack");

                if (GUI.Button(new Rect(uix, uiy, 100, 30), "Fly"))
                {
                    if (flying == true)
                    {
                        flying          = false;
                        Physics.gravity = this.originalGravity;
                    }
                    else
                    {
                        flying = true;
                        this.originalGravity = Physics.gravity;
                        Physics.gravity      = Vector3.zero;
                    }
                    Console.WriteLine("[PikMod  ] Flying: " + flying);
                }
                if (GUI.Button(new Rect(uix, uiy + 100, 200, 30), "Toggle Custom Gravity"))
                {
                    gravityt = !gravityt;
                    if (gravityt == false)
                    {
                        this.originalGravity = Physics.gravity;
                        Physics.gravity      = new Vector3(0, hSliderValue, 0);
                    }
                    else
                    {
                        Physics.gravity = this.originalGravity;
                    }
                }

                hSliderValue = GUI.HorizontalSlider(new Rect(uix, uiy + 50, 300, 100), hSliderValue, -10F, 10.0F);


                xrSliderValue = GUI.HorizontalSlider(new Rect(uix, uiy + 350, 300, 100), xrSliderValue, 0F, 360F);
                yrSliderValue = GUI.HorizontalSlider(new Rect(uix, uiy + 400, 300, 100), yrSliderValue, 0F, 360F);
                zrSliderValue = GUI.HorizontalSlider(new Rect(uix, uiy + 450, 300, 100), zrSliderValue, 0F, 360F);

                PlayerUtils.Rotate(player, xrSliderValue, yrSliderValue, zrSliderValue);


                GUI.Label(new Rect(uix, uiy + 150, 200, 50), "Current Gravity: " + Physics.gravity.y.ToString());



                if (GUI.Button(new Rect(uix, uiy + 250, 100, 30), "Teleport"))
                {
                    VRC.Player player = PlayerUtils.FindPlayer(Target);
                    PlayerUtils.TeleportTo(player);
                    Console.WriteLine("Teleporting to: {0}", player.GetAPIUser().displayName);
                }
                // int l = 0;


                // int m = 0;
                if (GUI.Button(new Rect(uix, uiy + 300, 200, 30), "Jump"))
                {
                    if (VRCPlayer.Instance.gameObject.GetComponent <PlayerModComponentJump>())
                    {
                        Console.WriteLine("World already has jump enabled.");
                        return;
                    }
                    else
                    {
                        VRCPlayer.Instance.gameObject.AddComponent <PlayerModComponentJump>();
                        Console.WriteLine("Enabled jumping in current world.");
                    }
                }
            }
            GUI.Label(new Rect(0f, (float)Screen.height - 100f, 1000f, 1000f), string.Concat(new object[]
            {
                "<b><color=#08ff00>Current Position:</color> <color=#ff0000>X:",
                Math.Round(PlayerManager.GetCurrentPlayer().gameObject.transform.position.x),
                "/Y:",
                Math.Round(PlayerManager.GetCurrentPlayer().gameObject.transform.position.y),
                "/Z:",
                Math.Round(PlayerManager.GetCurrentPlayer().gameObject.transform.position.z) + "</color></b>"
            }));
        }
    }
コード例 #32
0
ファイル: WinUI.cs プロジェクト: SonGit/NailGame
 /// <summary>
 /// sava data
 /// </summary>
 void SaveData()
 {
     int index = PLayerInfo.MapPlayer.Level - 1;
     DataLoader.MyData[index] = PLayerInfo.MapPlayer;
     if (PLayerInfo.MapPlayer.Level < 297)
         DataLoader.MyData[index + 1].Locked = false;  
     PlayerUtils p = new PlayerUtils();
     p.Save(DataLoader.MyData);
 }
コード例 #33
0
ファイル: DataLoader.cs プロジェクト: SonGit/NailGame
    /// <summary>
    /// Draw buttons level on scene
    /// </summary>
    /// <returns></returns>
    IEnumerator MapButtonDrawer()
    {
        DataLoader.enableclick = false;
        MapPosD();
        processbar.fillAmount = 0.3f;
        yield return new WaitForSeconds(0.3f);
        PlayerUtils pu = new PlayerUtils();
        MyData = pu.Load();
        processbar.fillAmount = 0.5f;
        yield return new WaitForSeconds(0.3f);

        for (int i = 0; i < 99; i++)
        {
            processbar.fillAmount += 0.0016835016835017f * 3;
            insmap(mappos[i], i);
            insmap(mappos[i + 99], i + 99);
            insmap(mappos[i + 198], i + 198);

            yield return null;
        }

        processbar.transform.parent.gameObject.SetActive(false);
        DataLoader.enableclick = true;
        if (CameraMovement.StarPointMoveIndex != -1 && CameraMovement.StarPointMoveIndex != 297)
        {
            StarPointMove();
            yield return new WaitForSeconds(STARMOVE_TIME);
            CameraMovement.mcamera.PopUpShow(MyData[CameraMovement.StarPointMoveIndex]);

            PlayerPrefs.SetFloat("LASTPOS", listmap[CameraMovement.StarPointMoveIndex].transform.position.y);
            PlayerPrefs.SetFloat("LASTPOSX", listmap[CameraMovement.StarPointMoveIndex].transform.position.x);

        }
        else
        {
            fade.GetComponent<CanvasGroup>().blocksRaycasts = false;
            CameraMovement.mcamera.StarPoint.transform.GetChild(0).GetComponent<Animation>().Play("StarPoint");
        }

		SetFriendProgress ();
	}