Пример #1
0
    // Use this for initialization
    void Start()
    {
        choices = new Image[4];
        scores  = new Text[4];
        for (int i = 0; i < 4; i++)
        {
            choices[i] = GameObject.Find("Choice" + (i + 1).ToString()).GetComponent <Image>();
            scores[i]  = GameObject.Find("Score" + (i + 1).ToString()).GetComponent <Text>();
        }
        monster = new Image[5];
        monster[(int)VoteType.MOUTH] = GameObject.Find("Mouth").GetComponent <Image>();
        monster[(int)VoteType.EYES]  = GameObject.Find("Eyes").GetComponent <Image>();
        monster[(int)VoteType.HAT]   = GameObject.Find("Hat").GetComponent <Image>();
        monster[(int)VoteType.ARMS]  = GameObject.Find("Arms").GetComponent <Image>();
        monster[4]        = GameObject.Find("Body").GetComponent <Image>();
        monster[4].sprite = bodies[2];
        monster[4].color  = Color.white;

        voteText = GameObject.Find("VoteTime").GetComponent <Text>();
        time     = GameObject.Find("Time").GetComponent <Text>();
        //server = GameObject.Find("Server").GetComponent<Server>();
        //server.SetupServer();
        socketClient = SocketClient.GetInstance();
        socketClient.voteEventCallbacks += onVoteMessageReceived;
        socketClient.ChangeMode(0);
        socketClient.ChangeVoteStatus(false);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        explo = GameObject.Find("Explosions").GetComponent <ParticleSystem>();
        //server = GameObject.Find("Server").GetComponent<Server>();
        scoreText       = GameObject.Find("ScoreText").GetComponent <Text> ();
        timerText       = GameObject.Find("TimerText").GetComponent <Text> ();
        calibrateScreen = GameObject.Find("CalibrateScreen").GetComponent <CanvasGroup> ();
        canvas          = GameObject.Find("Canvas");
        canvasTransform = canvas.GetComponent <RectTransform>().position;
        score           = 0;
        timer           = 10;
        timerText.text  = timer.ToString();
        positions       = new Dictionary <string, Vector3>();
        targets         = new Dictionary <string, GameObject>();
        firing          = new Dictionary <string, bool>();
        mouseTesting    = GameObject.Find("MouseTesting").GetComponent <MouseTesting>();

        if (TextureCharacter.getInstance().tex != null)
        {
            enemyMat.mainTexture = TextureCharacter.getInstance().tex;
        }
        else
        {
            enemyMat.mainTexture = defaultEnemyTex;
        }
        //server.SetupServer();
        //server.RegisterHandler(ActionMessage.id, OnReceivedActionMessage);
        //server.RegisterHandler(CalibrationMessage.id, calibration.OnCalibrationMessageReceived);
        socketClient = SocketClient.GetInstance();
        socketClient.ChangeMode(1);
        socketClient.updateEventCallbacks += OnReceivedUpdateMessage;
        socketClient.fireEventCallbacks   += OnReceivedFireMessage;
        myEnemiesComp = GameObject.Find("EnemiesManager").GetComponent <Enemies> ();
        StartCoroutine(GameCoroutine());
    }