Example #1
0
    // Use this for initialization
    void Start()
    {
        timerText      = timerObj.GetComponent <Text>();
        scoreText      = scoreObj.GetComponent <Text>();
        scoreText.text = totalScore.ToString();
        recGen         = GetComponent <RecipeGenerator>();

        //Get a reference to the network manager
        netMan = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <RoboNetManager>();

        if (isServer)
        {
            //Generate a recipe
            recGen.GenerateRecipe();

            //Spawn the players
            List <GameObject> matchPlayers = new List <GameObject>();

            //Create a temp list of all the players in the current match
            foreach (GameObject g in netMan.playerManagers)
            {
                g.GetComponent <PlayerManager>().InitCamGimbal();

                foreach (GameObject p in g.GetComponent <PlayerManager>().playerObjs)
                {
                    matchPlayers.Add(p);
                }
            }

            //See if there are any spawn points. If not, we won't take over spawning
            if (spawnPoints.Count == 0)
            {
                return;
            }

            //Temp count for spawning players
            int tempCount = 0;

            //Spawn the players
            for (int i = 0; i < matchPlayers.Count; i++)
            {
                if (i > spawnPoints.Count)
                {
                    tempCount += matchPlayers.Count;
                }
                matchPlayers[i].GetComponent <ActionHandler>().MovePlayer(spawnPoints[i - tempCount].transform.position);
            }
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        // References here
        netMan = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <RoboNetManager>();

        if (netMan != null)
        {
            netMan.playerManagers.Add(this.gameObject);

            gameObject.transform.SetParent(netMan.gameObject.transform);
        }

        // Called when the object first is initialized
        InitCamGimbal();

        Debug.Log("PlayerManagerStart");
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     netMan = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <RoboNetManager>();
 }