Exemple #1
0
 void Update()
 {
     // enables or disables mouse lock and visibility also pauses game if mouse is visible
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         if (Cursor.visible == true)
         {
             Cursor.lockState = CursorLockMode.Locked;
             Cursor.visible   = false;
             Time.timeScale   = 1f;
             settingsPopUp.Close();
         }
         else
         {
             Cursor.lockState = CursorLockMode.None;
             Cursor.visible   = true;
             Time.timeScale   = 0f;
             settingsPopUp.Open();
         }
     }
     // enables shooing only if game isnt paused
     if (Time.timeScale != 0)
     {
         if ((Input.GetKeyDown(KeyCode.RightControl)) && (!EventSystem.current.IsPointerOverGameObject()))
         {
             // this creates a vector with the coridnates of the rays origin
             Vector3 point = new Vector3(_camera.pixelWidth / 2, _camera.pixelHeight / 2, 0);
             muzzleFlash.Play();
             gunShot.Play();
             // creates ray object with origin cordinates
             Ray ray = _camera.ScreenPointToRay(point);
             // pases the ray and a new object with type RaycastHit
             if (Physics.Raycast(ray, out RaycastHit hit))
             {
                 // this retrieves the object the ray hit
                 GameObject     hitObject  = hit.transform.gameObject;
                 ReactiveTarget target     = hitObject.GetComponent <ReactiveTarget>();
                 GameObject     enemy      = hit.transform.gameObject;
                 WanderingAI    lifeStatus = enemy.GetComponent <WanderingAI>();
                 // this checks if the target is a person though the get component method and if it is
                 // it returns a hit and if not it creates a sphere in the debug console.
                 // get component returns null if the component isnt there.
                 if ((target != null) && (lifeStatus.getAlive()))
                 {
                     target.ReactToHit();
                     Messenger.Broadcast(GameEvent.ENEMY_HIT);
                 }
                 else
                 {
                     // starts the coroutine kicking control to it
                     StartCoroutine(SphereIndicator(hit.point));
                 }
             }
         }
     }
 }
Exemple #2
0
    //Function to control the popup for player1 stats.
    public void OnPlayerOneOpenSettings()
    {
        owner = MasterControl.control.currGame.currentPlayer;

        //Popup will only show when countOne is 0 and it is currently player1's turn (owner - 1)
        if (countOne == 0 && owner == 0)
        {
            settingsPopup.Open();
        }

        else
        {
            settingsPopup.Close();
        }

        if (owner == 0)
        {
            countOne = (countOne + 1) % 2;
        }
        //Debug.Log("Publicity: " + MasterControl.control.currGame.players1[owner].GetComponent<Player>().publicity);
    }
Exemple #3
0
    //Function to control the popup for player1 stats.
    public void OnPlayerOpenSettings()
    {
        owner = MasterControl.control.currGame.currentPlayer;

        //Popup will only show when countOne is 0 and it is currently player1's turn (owner - 1)
        if (countOne == 0 && owner == 0 ||
            (countOne == 1 && owner == 1) ||
            (countOne == 2 && owner == 2))
        {
            settingsPopup.setCurrPlayer(owner);
            settingsPopup.Open();
        }
        else
        {
            settingsPopup.Close();
        }

        countOne = (countOne + 1) % 3;

        Debug.Log("countOne = " + countOne);
        Debug.Log("Publicity: " + MasterControl.control.currGame.players1[owner].GetComponent <Player>().publicity);
    }
Exemple #4
0
    public void OnResearchOpenSettings()
    {
        Debug.Log(countResearch);
        if (countResearch == 0)
        {
            settingsPopup.Open();
        }

        else
        {
            settingsPopup.Close();
        }

        countResearch = (countResearch + 1) % 2;
    }
Exemple #5
0
    public void OnOpenSettings()
    {
        //Debug.Log("Opened");

        if (count % 2 == 0)
        {
            settingsPopup.Open();
            Debug.Log(count);
        }

        else
        {
            settingsPopup.Close();
            Debug.Log(count);
        }

        count++;
    }
Exemple #6
0
 public void OpenSettings()
 {
     settingsPopup.Open();
 }
Exemple #7
0
 public void OnOpenSettings()
 {
     settingsPopUp.Open();
 }
Exemple #8
0
 public void OnOpenSettings()
 {
     settingsPopup.Open(); // Заменяем отладочный текст методом всплывающего окна
 }
Exemple #9
0
    public void OnOpenSettings()
    {
        SettingsPopup.Open();
//		Debug.Log ("open setting");
    }