Example #1
0
    void Start()
    {
        opponents = new Dictionary<int, GameObject>();
        pNum = -1;
        net = LoginScript.net;

        //create pellets
        for(int i = 0; i < 5; i++){

            pellets[i] = GameObject.CreatePrimitive(PrimitiveType.Capsule);
            pellets[i].renderer.material.color = new Color(55f,0f,255f,0.5f);
            pellets[i].renderer.material.shader = Shader.Find("Transparent/Diffuse");
            pellets[i].transform.localScale = new Vector3(0.2f,0.2f,0.2f);
            pellets[i].transform.RotateAround(Vector3.zero, Vector3.forward, 20 * Random.Range(1,100));

            //sets the name of the pellet to the number of the pellet for easier collision detection (SEE PLAYER.CS)
            pellets[i].name = i.ToString();

            //Make outer membrane of pellets
            pelletShadows[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            pelletShadows[i].renderer.material.color = new Color(105f,50f,255f,0.5f);
            pelletShadows[i].renderer.material.shader = Shader.Find("Transparent/Diffuse");
            pelletShadows[i].transform.localScale = new Vector3(1f,1f,1f);
            //pelletShadows[i]
        }

        myP = GameObject.Find("Player").GetComponent<Player>();
        //sets up game variables
        score = 0;

        //Sets player name to login name
        pName =  GameObject.Find("PlayerName").GetComponent<GUIText>();
        pName.text = myName;

        //Sets title text on screen
        title =  GameObject.Find("Title").GetComponent<GUIText>();
        title.fontSize = 50;

        //Sets up score on the screen
        scoreText =  GameObject.Find("Score").GetComponent<GUIText>();
        scoreText.text = "Score: " + score;

        //Sets up score title on sideline
        scoreBoardTitle =  GameObject.Find("ScoreBoardTitle").GetComponent<GUIText>();
        scoreBoardTitle.fontSize = 25;
        scoreBoardTitle.text = "Score Board";

        scoreBoard =  GameObject.Find("ScoreBoard").GetComponent<GUIText>();
    }
Example #2
0
    void Start()
    {
        //UI MAY LOOK WEIRD IN UNITY PREVIEW WINDOW
        //SET UP TO LOOK NICE IN ACTUAL GAME WINDOW
        //Set up title
        title =  GameObject.Find("Title").GetComponent<GUIText>();
        title.transform.position = new Vector3(0.5f,0.9f,0f);
        title.fontSize = 50;

        //UserName Label on the screen
        UNLabel =  GameObject.Find("UNLabel").GetComponent<GUIText>();
        UNLabel.transform.position = new Vector3(0.5f,0.63f,0f);

        //Password Label on the screen
        PWLabel =  GameObject.Find("PWLabel").GetComponent<GUIText>();
        PWLabel.transform.position = new Vector3(0.5f,0.570f,0f);

        //Initialize pw and user name to avoid null pointer
        password = userName = "******";

        errMsg = "";

        //connect to the server when they open up a game client
        net = gameObject.AddComponent<myNetwork>();
        net.Connect();
    }
Example #3
0
 void Start()
 {
     process = GameObject.Find("GameProcess").GetComponent<GameProcess>();
     net = LoginScript.net;
 }