Пример #1
0
        public void Reset(bool isNewGame)
        {
            // Move the Rigidbody
            Body.isKinematic   = true;
            transform.position = SyncedInfo.StartingPosition;
            Body.velocity      = Vector3.zero;
            Body.isKinematic   = false;

            // Setup the next game
            if (isNewGame == true)
            {
                SyncedInfo.SetupNextGame();
            }
        }
Пример #2
0
        void Update()
        {
            if ((Input.GetMouseButtonDown(0) == true) && (CanMove == true))
            {
                // Calculate the direction to move
                Vector3 direction = MoveCursor.Instance.transform.position - transform.position;
                NormalizeDirection(ref direction);

#if SERVER
                // If the server, just move the ball directly
                Move(direction, false);
#else
                if (MenuCollection.Instance != null)
                {
                    if (MenuCollection.Settings.CurrentEnergy > 0)
                    {
                        // If the client, send to the database the direction you've entered
                        SyncedInfo.QueueDirection(direction);
                        MenuCollection.Settings.CurrentEnergy -= 1;

                        if (MenuCollection.Instance.CurrentState == MenuCollection.MenuState.Controls)
                        {
                            MenuCollection.Instance.CurrentState = MenuCollection.MenuState.Congrats;
                        }
                        else if (((MenuCollection.Settings.SeenTutorial & AddPower.TutorialFlags.LowEnergy) == 0) &&
                                 (MenuCollection.Settings.CurrentEnergy < (AddPower.MaxEnergy / 2)) &&
                                 (MenuCollection.Instance.CurrentState == MenuCollection.MenuState.Playing))
                        {
                            // Check if we're half-way through the energy, and haven't seen the tutorial yet
                            MenuCollection.Instance.CurrentState = MenuCollection.MenuState.LowEnergy;
                        }
                    }
                    else if (MenuCollection.Instance.CurrentState == MenuCollection.MenuState.Playing)
                    {
                        MenuCollection.Instance.CurrentState = MenuCollection.MenuState.NoEnergy;
                    }
                }
#endif
            }
        }