public static BasePlayerData GetPlayerData(int playerID)
    {
        BasePlayerData data = null;

        switch (playerID)
        {
        case 0:
            data = new PlayerData_00();
            break;

        case 1:
            data = new PlayerData_01();
            break;

        case 2:
            data = new PlayerData_02();
            break;

        case 3:
            data = new PlayerData_03();
            break;

        default:
            Debug.Log("SOMETHING WENT WRONG HERE: playerID: " + playerID);
            break;
        }
        return(data);
    }
Esempio n. 2
0
    public static void LoadPlayerDataInToManager(int playerID)
    {
        BasePlayerData data = null;

        switch (playerID)
        {
        case 0:
            data = new PlayerData_00();
            break;

        case 1:
            data = new PlayerData_01();
            break;

        case 2:
            data = new PlayerData_02();
            break;

        case 3:
            data = new PlayerData_03();
            break;

        default:
            Debug.Log("SOMETHING WENT WRONG HERE: playerID: " + playerID);
            break;
        }
        PlayerData = data;
    }
Esempio n. 3
0
    // DONT F*****G TOUCH THIS FUNCTION
    void CreatePlayerAgent()
    {
        _syncedVars = FindObjectOfType <SyncedVars>();
        if (_syncedVars == null)
        {
            Debug.LogError("OOPSALA we have an ERROR!");
        }

        transform.SetParent(_playerManager.transform);
        _uiManager.GetComponent <Canvas>().enabled = true;

        _seed            = _syncedVars.GlobalSeed;
        seedNumText.text = _seed.ToString();
        Random.InitState(_seed);

        _syncedVars.CmdTellServerToUpdatePlayerCount();

        if (isLocalPlayer)
        {
            _playerUniqueID     = _syncedVars.PlayerCount;
            playerIDText.text   = _playerUniqueID.ToString();
            _playerData         = _playerManager.GetPlayerData(_playerUniqueID);
            playerNameText.text = _playerData.name;
            ContinuePlayerSetUp();
        }
    }
    public static void MoveShip(BasePlayerData playerData, WorldNode worldNode)
    {
        Vector3Int testLocVect = PlayerManager.GetTESTShipMovementPositions(playerData.playerID);
        Vector3Int testRotVect = Vector3Int.zero;
        float      thrust      = 5;

        worldNode.MakeNodeMoveToLoc(testLocVect, testRotVect, true);
    }
Esempio n. 5
0
    ////////////////////////////////////////////////
    ////////////////////////////////////////////////
    public static void CreatePlayerShip(NetworkNodeStruct nodeStruct, int playerID)
    {
        Vector3Int nodeID = new Vector3Int(Mathf.FloorToInt(nodeStruct.NodeID.x), Mathf.FloorToInt(nodeStruct.NodeID.y), Mathf.FloorToInt(nodeStruct.NodeID.z));

        WorldNodeStruct worldNodeData = new WorldNodeStruct()
        {
            NodeID  = nodeID,
            CurrLoc = new Vector3Int(Mathf.FloorToInt(nodeStruct.CurrLoc.x), Mathf.FloorToInt(nodeStruct.CurrLoc.y), Mathf.FloorToInt(nodeStruct.CurrLoc.z)),
            CurrRot = new Vector3Int(Mathf.FloorToInt(nodeStruct.CurrRot.x), Mathf.FloorToInt(nodeStruct.CurrRot.y), Mathf.FloorToInt(nodeStruct.CurrRot.z)),
        };

        WorldNode worldNode = WorldBuilder._nodeBuilder.CreateWorldNode(worldNodeData);

        LocationManager.SaveNodeTo_CLIENT(nodeID, worldNode);

        BasePlayerData playerData = PlayerManager.GetPlayerData(playerID);

        worldNode.transform.eulerAngles = new Vector3Int(0, 90, 0);

        worldNode.NodeData.worldNodeMapPieces = playerData.shipMapPieces;

        MapNodeBuilder.CreateMapNodesForWorldNode(worldNode);

        Dictionary <Vector3Int, WorldNode> dict = new Dictionary <Vector3Int, WorldNode>();

        dict.Add(nodeID, worldNode);
        //LayerManager.AssignLayerCountsToWorldAndMapNodes(dict);

        //if (playerID == PlayerManager.PlayerID)
        //{
        foreach (MapNode mapNode in worldNode.mapNodes)
        {
            mapNode.ActivateMapPiece(true);
        }
        //}

        if (playerData.playerID == PlayerManager.PlayerID)
        {
            MoveShip(playerData, worldNode);

            worldNode.transform.Find("RotationalNode").GetComponent <RotationalNode>()._rotate = true;
            PlayerManager.PlayersShipLoaded();
        }
    }