Example #1
0
 void OnDestroy()
 {
     if (ObjectManagerScript.Instance())
     {
         ObjectManagerScript.Instance().UnRegisterBoardObject();
     }
 }
Example #2
0
 void OnDestroy()
 {
     if (ObjectManagerScript.Instance())
     {
         ObjectManagerScript.Instance().UnRegisterCursorObject(gameObject);
     }
     Screen.showCursor = true;
 }
Example #3
0
 void OnDestroy()
 {
     if (Network.isServer)
     {
         if (ObjectManagerScript.Instance())
         {
             ObjectManagerScript.Instance().UnRegisterGrabbableObject(gameObject);
         }
     }
 }
Example #4
0
 void Start()
 {
     if (Network.isServer)
     {
         if (ObjectManagerScript.Instance())
         {
             ObjectManagerScript.Instance().RegisterGrabbableObject(gameObject);
         }
     }
 }
Example #5
0
    void StartZoom()
    {
        var cursor = ObjectManagerScript.Instance().GetMyCursorObject();

        if (cursor)
        {
            target_rotation.SetLookRotation(cursor.transform.position - transform.position, old_rotation * new Vector3(0, 1, 0));
        }
        zoomed = true;
    }
Example #6
0
 void Start()
 {
     if (networkView.isMine)
     {
         SpawnDice();
     }
     if (ObjectManagerScript.Instance())
     {
         ObjectManagerScript.Instance().RegisterBoardObject(gameObject);
     }
 }
Example #7
0
    // Update is called once per frame
    void Update()
    {
        var cursor = ObjectManagerScript.Instance().GetMyCursorObject();

        if (cursor)
        {
            old_rotation = transform.rotation;
            transform.LookAt(cursor.transform.position, GameObject.Find("Main Camera").transform.up);
            transform.rotation = Quaternion.Lerp(transform.rotation, old_rotation, Mathf.Pow(ZOOM_INERTIA, Time.deltaTime));
            //transform.up = GameObject.Find("Main Camera").transform.up;
        }
    }
Example #8
0
 void Start()
 {
     if (networkView.isMine)
     {
         id_ = Net.GetMyID();
     }
     if (ObjectManagerScript.Instance())
     {
         ObjectManagerScript.Instance().RegisterCursorObject(gameObject);
     }
     Screen.showCursor = false;
 }
Example #9
0
 void OnCollisionEnter(Collision info)
 {
     if (info.relativeVelocity.magnitude > 1.0f && Time.time > last_sound_time + PHYSICS_SOUND_DELAY)
     {
         float volume = info.relativeVelocity.magnitude * 0.1f;
         ImpactSound(volume);
         last_sound_time = Time.time;
     }
     if (Network.isServer)
     {
         if (info.collider.GetComponent <DeckScript>())
         {
             ObjectManagerScript.Instance().NotifyDeckHitDeck(gameObject, info.collider.gameObject);
         }
     }
 }
Example #10
0
 public void TellObjectManagerAboutMouseRelease(int player_id)
 {
     ObjectManagerScript.Instance().ClientReleasedMouse(player_id);
 }
Example #11
0
 public void TellObjectManagerAboutCardPeel(int grab_id, int player_id)
 {
     ObjectManagerScript.Instance().ClientCardPeel(grab_id, player_id);
 }
Example #12
0
    void DrawGameGUI()
    {
        if (chat_shown_)
        {
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                if (chat_.Length > 0)
                {
                    SendChatMessage(chat_);
                }
                chat_       = "";
                chat_shown_ = false;
                GUI.FocusControl("TheLabel");
                Event.current.Use();
            }
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
            {
                chat_       = "";
                chat_shown_ = false;
                GUI.FocusControl("TheLabel");
                Event.current.Use();
            }
        }
        else
        {
            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                chat_shown_ = true;
                //ConsoleScript.Log ("Showing chat");
                Event.current.Use();
            }
        }

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Exit Game"))
        {
            Network.Disconnect();
            Application.LoadLevel(Application.loadedLevel);
        }
        GUILayout.EndHorizontal();

        /*GUILayout.BeginHorizontal();
         * if(GUILayout.Button("Copy Join URL To Clipboard")){
         *      RequestPageURLForCopyGameJoin();
         * }
         * GUILayout.EndHorizontal();*/
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Restart Game"))
        {
            ObjectManagerScript.Instance().RecoverDice();
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        GUILayout.Label(game_name_);
        GUILayout.EndHorizontal();
        Dictionary <int, PlayerInfo> player_info_list = PlayerListScript.Instance().GetPlayerInfoList();

        foreach (var pair in player_info_list)
        {
            GUI.contentColor = pair.Value.color_;
            GUILayout.BeginHorizontal();
            GUILayout.Label(pair.Key + ": " + pair.Value.name_);
            GUILayout.EndHorizontal();
            GUI.contentColor = Color.white;
        }


        GUILayout.BeginArea(new Rect(Screen.width - 200, 0, 200, 300));
        if (!help_shown_)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press '?' for help", help_gui_skin.label);
            GUILayout.EndHorizontal();
        }
        else
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press '?' to close help", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press 'Z' to zoom in", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press 'WASD' to move while zoomed", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press 'Q' or 'E' to rotate cards", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press 'R' to rotate a card to be readable", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press 'F' to flip cards", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press 'T' to tap tokens", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press 'RETURN' to chat", help_gui_skin.label);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Press '1-5' to play different songs", help_gui_skin.label);
            GUILayout.EndHorizontal();
        }
        GUILayout.EndArea();

        if (chat_shown_)
        {
            GUILayout.BeginArea(new Rect(Screen.width * 0.5f - 200, Screen.height - 30, 400, 200));
            GUILayout.BeginHorizontal();
            GUI.SetNextControlName("TheLabel");
            GUILayout.Label("Chat:");
            GUI.SetNextControlName("ChatField");
            chat_ = GUILayout.TextField(chat_, GUILayout.MinWidth(350));
            if (chat_.Length > 90)
            {
                chat_ = chat_.Substring(0, 90);
            }
            GUI.FocusControl("ChatField");
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
        if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Slash)
        {
            help_shown_ = !help_shown_;
            Event.current.Use();
        }
    }