Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     //at GO
     press = false;
     Plist = new PathList();
     Plist.initList();
     turn = 0;
     CurrentPos = new Vector3(0,5,0);
 }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        takeAttack = false;
            DuelMode = false;

            winwidth = Screen.width;
            winheight = Screen.height;

            Debug.Log(winwidth+" "+winheight);

            // initialise 4player game
            Vector3 st = new Vector3(0,5,0);
             long amount = 250000;

             startTime =0;
            deltaTime = 0.5f;

            pause = false;
            rollyes = false;
            totalPlayers = 4;
            turn = 0;

            for(int i=0;i<64;i++)
                InfoBox[i]=-1;

                float x=-0.08f,y=-0.095f,wx=0.23f,wy=0.2f;
            Rect A = new Rect(x*winwidth,y*winheight,wx*winwidth,wy*winheight);

            wx = 0.05f;
            wy=0.1f;
            y = -0.077f;
            Rect B1 = new Rect(x*winwidth,y*winheight,wx*winwidth,wy*winheight);

            float bX = -0.09f;
            float bY = -0.1f;
            float bH = 0.04f;
            float bW = 0.02f;
            Rect B2 = new Rect(bX*winwidth,bY*winheight,bW*winwidth,bH*winheight);

         	    for(int i=0;i<totalPlayers;i++)
            {
                Players[i] = new GamePlayers();
                Players[i].init(i, amount, st, 0, 0, 0, 0, 5,true);
                PlayerTextures[i].pixelInset = A;
                PlayerTextures[i].transform.Find("logo").guiTexture.pixelInset = B1;
                PlayerTextures[i].transform.Find("cuff1").guiTexture.pixelInset = B2;
                PlayerTextures[i].transform.Find("cuff2").guiTexture.pixelInset = B2;
                PlayerTextures[i].transform.Find("cuff3").guiTexture.pixelInset = B2;

            }

            wx = 0.05f;
            wy = 0.05f;
            Rect D1 = new Rect(x*winwidth,y*winheight,wx*winwidth,wy*winwidth);
            Dice1.pixelInset = D1;
            y=0.0001f;
            Rect D2 = new Rect(x*winwidth,y*winheight,wx*winwidth,wy*winwidth);
            Dice2.pixelInset = D2;

            Vector3 startpos = new Vector3(0,7.5f,0);

            GobPlayer = new GameObject[4];

        //	GobPlayer = Resources.LoadAll("Player") as GameObject[];

            float tosub=-1;

            for(int i=0;i<totalPlayers;i++)
            {
            GameObject instanceg = new GameObject();
                startpos.x = tosub + i;
            instanceg = Instantiate(PlayerFab,startpos,transform.rotation) as GameObject;
            GobPlayer[i] = instanceg;
            for(int j=0;j<4;j++)
            GobPlayer[i].transform.Find("Pcam"+j).camera.enabled = false;
            gameObject.transform.Find("Camera"+i).camera.enabled = false;
        ///	gameObject.transform.Find("Camera"+i).camera.transform.Find("AmbientLight").light.enabled = false;
            }

            gameObject.transform.Find("Camera0").camera.enabled = true;
        //	gameObject.transform.Find("Camera0").camera.transform.Find("AmbientLight").light.enabled= true;
            Plist = new PathList();
            Plist.initList();

                GameObject instance = new GameObject();
                instance = Instantiate(Dicefab,instance.transform.position,instance.transform.rotation) as GameObject;

                instance.name="Dicer1";

                GameObject instance2 = new GameObject();
                instance2 = Instantiate(Dice2fab,instance2.transform.position,transform.rotation) as GameObject;
                instance2.name="Dicer2";

                V1Dice = instance.GetComponent<DiceValue>();
                V2Dice = instance2.GetComponent<DiceValue>();

            Dice1 = Instantiate(Dice1) as GUITexture;

            Dice2 = Instantiate (Dice2) as GUITexture;

            initDepartments();

            //
            Debug.Log("gameinited");
    }