예제 #1
0
    void Awake()
    {
        //Get a component reference to the SpriteRenderer.
        spriteRenderer = GetComponent <SpriteRenderer>();

        grid = ClientLibrary.Grid.instance;
    }
예제 #2
0
        private void Start()
        {
            //grid 초기화
            grid = ClientLibrary.Grid.instance;

            if (PhotonNetwork.IsMasterClient && photonView.IsMine)
            {
                Debug.Log("나마스터임");
                photonView.RPC("ChangeColorA", RpcTarget.All);
                CountdownTimer.instance.playerA = true;
            }
            else if (photonView.IsMine)
            {
                photonView.RPC("ChangeColorB", RpcTarget.All);
                CountdownTimer.instance.playerB = true;
            }

            if (!photonView.IsMine)
            {
                return;
            }
            else
            {
                //smoothMovment null 초기화
                smoothMovement = SmoothMovement(null);

                //Get a component reference to this object's BoxCollider2D
                boxCollider = GetComponent <BoxCollider>();

                //currentGrid 초기화
                currentGrid = grid.GetNearestPointOnGrid(transform.position);

                controller = GetComponent <CharacterController>();

                //위치 초기화
                transform.position = grid.GetCurrentGrid(transform.position) + new Vector3(0.001f, 0, 0.001f);//반올림 error 보간값
            }
        }
예제 #3
0
        private float playTime        = 0; //게임 플레이 제한 시간

        public void Start()
        {
            //윈,루즈,드로우 판넬에 게임종료 메서드 삽입
            winPanel.GetComponent <Button>().onClick.AddListener(() => LeaveRoom());
            losePanel.GetComponent <Button>().onClick.AddListener(() => LeaveRoom());
            drawPanel.GetComponent <Button>().onClick.AddListener(() => LeaveRoom());


            //playtime 초기화
            PLAY_TIME = PREPARATION_TIME + 60;

            if (Text == null)
            {
                Debug.LogError("Reference to 'Text' is not set. Please set a valid reference.", this);
                return;
            }
            startTime = (float)PhotonNetwork.Time;

            grid = FindObjectOfType <ClientLibrary.Grid>();

            //타이머 실행
            StartCoroutine(PreparationTimer());
        }