示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        countdownTimer = COUNTDOWN_LENGTH;
        curEvent       = EVENT_NONE;
        lastEvent      = EVENT_NONE;
        eventParams    = 0;
        DontDestroyOnLoad(this.gameObject);
        if (isServer)
        {
            playerObjects = new GameObject[] { null, null, null, null, null, null, null, null };
        }
        else
        {
            playerObjects  = null;
            networkManager = null;
        }
        spawnManager = null;
        localClient  = GameObject.FindObjectOfType <NeonHeightsLobbyClient2>();

        connectionId    = -1;
        numberOfPlayers = 0;
        nextLevel       = "random";
        gameStarted     = false;
        playerConnectionIDs.Callback += OnPlayerConnectionIDsUpdated; //SyncList.Callback is called the variable is changed
        //on the server
    }
示例#2
0
    public void MouseSelectAction()
    {
        NeonHeightsLobbyClient2 clientHandler = GameObject.FindObjectOfType <NeonHeightsDataHandler>().GetLocalClient();
        PlayerLobbyCursor       cursor        = clientHandler.GetKeyboardPlayer();

        if (cursor != null)
        {
            SelectAction(cursor);
        }
    }
示例#3
0
    void Start()
    {
        if (!hasAuthority)
        {
            Destroy(gameObject.GetComponent <PlayerInput>());
        }
        else
        {
            canMove     = false;
            playerInput = gameObject.GetComponent <PlayerInput>();
            print("PlayerInput: " + playerInput);
            playerInput.neverAutoSwitchControlSchemes = true;
            clientHandler = GameObject.FindObjectOfType <NeonHeightsDataHandler>().GetLocalClient();

            if (initialized)
            {
                clientHandler.AddPlayer(this);
            }
        }
    }
示例#4
0
    // Start is called before the first frame update
    void Start()
    {
        if (!hasAuthority)
        {
            Destroy(gameObject.GetComponent <PlayerInput>());
        }
        else
        {
            playerInput = gameObject.GetComponent <PlayerInput>();
            print("PlayerInput: " + playerInput);
            playerInput.neverAutoSwitchControlSchemes = true;
            clientHandler = GameObject.FindObjectOfType <NeonHeightsDataHandler>().GetLocalClient();

            if (keyboardControlled)
            {
                device = Keyboard.current;
            }
            else
            {
                device = Gamepad.current;
            }

            if (initialized)
            {
                clientHandler.AddCursor(this);
            }
        }

        cursorInput         = new CursorInput();
        canvas              = GameObject.FindObjectOfType <Canvas>();
        canvasRectTransform = canvas.GetComponent <RectTransform>();
        transform.SetParent(canvas.transform);
        transform.position = new Vector2(canvas.pixelRect.width / 2, canvas.pixelRect.height / 2);
        gameObject.transform.localScale = new Vector3(1, 1, 1);
        playerNumberText.text           = "P" + (playerIndex + 1);
        playerNumberTextShadow.text     = "P" + (playerIndex + 1);
        cursorImage.color = cursorColors[playerIndex];
        usernameText.text = "gamepad " + gamepadDeviceId;
    }
示例#5
0
 public void SetLocalClient(NeonHeightsLobbyClient2 localClient)
 {
     this.localClient = localClient;
 }