예제 #1
0
 void Start()
 {
     if (NodeInformation.isMaster())
     {
         state = MenuState.Main;
         refresh();
     }
 }
예제 #2
0
파일: MoveCubes.cs 프로젝트: bbuhtig/CAVE
 // Use this for initialization
 void Start()
 {
     if (!NodeInformation.isMaster())
     {
         enabled = false;
     }
     force = 5f;
     // initCubes();
 }
예제 #3
0
 public void creditsButton()
 {
     state = MenuState.Credits;
     refresh();
     if (!creditSpawned && NodeInformation.isMaster())
     {
         NetworkServer.Spawn(creditText);
         NetworkServer.Spawn(backBtn);
         creditSpawned = true;
     }
 }
예제 #4
0
 public void settingsButton()
 {
     state = MenuState.Options;
     refresh();
     if (!settingsSpawned && NodeInformation.isMaster())
     {
         NetworkServer.Spawn(musicBtn);
         NetworkServer.Spawn(backBtn);
         settingsSpawned = true;
     }
 }
예제 #5
0
파일: Reset.cs 프로젝트: bbuhtig/CAVE
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.R))
     {
         //Destroy(gameObject);
         if (NodeInformation.isMaster())
         {
             NetworkServer.Destroy(gameObject);
         }
     }
 }
예제 #6
0
    // Update is called once per frame
    void Update()
    {
        if (NodeInformation.isMaster())
        {
            // Press w or q to change frame spawn time and s or a to change multiplicator.
            if (Input.GetKeyDown(KeyCode.W))
            {
                spawnSpeed += spawnSpeedIncrease;
            }
            else if (Input.GetKeyDown(KeyCode.Q))
            {
                spawnSpeed -= spawnSpeedIncrease;
                if (spawnSpeed < 1)
                {
                    spawnSpeed = 1;
                }
            }
            else if (Input.GetKeyDown(KeyCode.S))
            {
                multiplicator++;
            }
            else if (Input.GetKeyDown(KeyCode.A))
            {
                multiplicator--;
                if (multiplicator < 1)
                {
                    multiplicator = 1;
                }
            }

            if (Input.GetKeyDown(KeyCode.T))
            {
                toggle = !toggle;
            }

            // Checks whether the "E" key is pressed.
            if (Input.GetKey(KeyCode.E) || toggle)
            {
                // Checks whether the defined ammount of frames have passed.
                if (counter % (float)spawnSpeed == 0)
                {
                    for (int i = 0; i < multiplicator; i++)
                    {
                        // Spawns the object at the appropriate location with an random offset between 0 and 1 multiplied by an offset.
                        Transform spawnSpheresObjects = Instantiate(obj, new Vector3(transform.position.x + Random.value * 30, transform.position.y + Random.value * 8, transform.position.z + Random.value * 28), Quaternion.identity);
                        NetworkServer.Spawn(spawnSpheresObjects.gameObject);
                    }
                }
            }

            counter++;
        }
    }
예제 #7
0
 public void playButton()
 {
     state = MenuState.Player;
     refresh();
     if (!playSpawned && NodeInformation.isMaster())
     {
         NetworkServer.Spawn(twoPlayers);
         NetworkServer.Spawn(threePlayers);
         NetworkServer.Spawn(fourPlayers);
         NetworkServer.Spawn(backBtn);
         playSpawned = true;
     }
 }
예제 #8
0
    public void createTower()
    {
        if (NodeInformation.isMaster())
        {
            setSizes();

            for (int i = 0; i < nrOfRows; i++)
            {
                addRow();
            }

            Debug.Log("Tower created");
        }
        state = State.BlockPlacing;
    }
예제 #9
0
    public void select(GameObject gameObject)
    {
        // Sound effect tower destroyed
        destroyAudioSource = GetComponent <AudioSource>();
        destroyAudioSource.Play();


        if (SelectedObj == null && FirstSelected == null)
        {
            FirstSelected = gameObject;
            SelectedObj   = gameObject;
            SelectedObj.GetComponent <Renderer>().material.color = Color.green;
            if (NodeInformation.isMaster())
            {
                changeRow(gameObject);
            }
        }
        else if (gameObject == FirstSelected)
        {
            deselect();
            SelectedObj = gameObject;
            SelectedObj.GetComponent <Renderer>().material.color = Color.green;
        }
    }