示例#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);
            }
        }
    }
示例#2
0
    public List <Image> resultSpritesScoreScreen; // The list of our resultSprites on the score screen

    // TODO need a list of all the stars in the score screen so we can set them to active

    // Start is called before the first frame update
    void Start()
    {
        RG = GameObject.FindGameObjectWithTag("RecipeGenerator").GetComponent <RecipeGenerator>();
        //chefsRecipeList = new List<Text>();
        //apprenticeIngredientList = new List<Text>();
    }