Example #1
0
    private void Update()
    {
        if (Input.GetKeyDown(createKey))
        {
            creationProgress = 0;
            CreateShape();
        }
        else if (Input.GetKey(createKey))
        {
            //automatic continuous creation
            creationProgress += Time.deltaTime * CreationSpeed;
            while (creationProgress >= 1)
            {
                creationProgress -= 1;
                CreateShape();
            }
        }

        else if (Input.GetKeyDown(newGameKey))
        {
            BeginNewGame();
        }
        else if (Input.GetKeyDown(saveKey))
        {
            storage.Save(this);
        }
        else if (Input.GetKeyDown(loadKey))
        {
            BeginNewGame();
            storage.Load(this);
        }
        else if (Input.GetKeyDown(destroyKey))
        {
            destructionProgress = 0;
            DestroyShape();
        }
        else if (Input.GetKey(destroyKey))
        {
            //automatic continuous creation
            destructionProgress += Time.deltaTime * DestructionSpeed;
            while (destructionProgress >= 1)
            {
                destructionProgress -= 1;
                DestroyShape();
            }
        }
    }
Example #2
0
 private void Update()
 {
     if (Input.GetKeyDown(createKey))
     {
         CreateObject();
     }
     else if (Input.GetKey(newGameKey))
     {
         BeginNewGame();
     }
     else if (Input.GetKey(saveKey))
     {
         storage.Save(this);
     }
     else if (Input.GetKey(loadKey))
     {
         BeginNewGame();
         storage.Load(this);
     }
 }
Example #3
0
 private void Update()
 {
     if (Input.GetKeyDown(newGameKey))
     {
         BeginNewGame();
         StartCoroutine(LoadLevel(LoadedLevelBuildIndex));
     }
     else if (Input.GetKeyDown(saveKey))
     {
         storage.Save(this);
     }
     else if (Input.GetKeyDown(loadKey))
     {
         BeginNewGame();
         storage.Load(this);
     }
     else if (Input.GetKeyDown(testKey))
     {
         //StartCoroutine(LoadLevel());
         //SceneManager.LoadScene("Level 1", LoadSceneMode.Additive);
         //Scene sceneTmp = SceneManager.GetSceneByName("Level 1");
         //Debug.Log("GetSceneByName : " + sceneTmp.name);
         //LoadLevel();
     }
     else
     {
         //load select level
         for (int i = 1; i <= levelCount; i++)
         {
             if (Input.GetKeyDown(KeyCode.Alpha0 + i))
             {
                 Debug.Log("Select Level : " + i);
                 BeginNewGame();
                 StartCoroutine(LoadLevel(i));
                 return;
             }
         }
     }
 }
Example #4
0
    private void Update()
    {
        if (Input.GetKeyDown(createKey))
        {
            creationProgress = 0;
            CreateShape();
        }
        else if (Input.GetKey(createKey))
        {
            //automatic continuous creation
            creationProgress += Time.deltaTime * CreationSpeed;
            while (creationProgress >= 1)
            {
                creationProgress -= 1;
                CreateShape();
            }
        }

        else if (Input.GetKeyDown(newGameKey))
        {
            BeginNewGame();
        }
        else if (Input.GetKeyDown(saveKey))
        {
            storage.Save(this);
        }
        else if (Input.GetKeyDown(loadKey))
        {
            BeginNewGame();
            storage.Load(this);
        }
        else if (Input.GetKeyDown(destroyKey))
        {
            destructionProgress = 0;
            DestroyShape();
        }
        else if (Input.GetKey(destroyKey))
        {
            //automatic continuous creation
            destructionProgress += Time.deltaTime * DestructionSpeed;
            while (destructionProgress >= 1)
            {
                destructionProgress -= 1;
                DestroyShape();
            }
        }
        else if (Input.GetKeyDown(testKey))
        {
            //StartCoroutine(LoadLevel());
            //SceneManager.LoadScene("Level 1", LoadSceneMode.Additive);
            //Scene sceneTmp = SceneManager.GetSceneByName("Level 1");
            //Debug.Log("GetSceneByName : " + sceneTmp.name);
            //LoadLevel();
        }
        else
        {
            //load select level
            for (int i = 1; i <= levelCount; i++)
            {
                if (Input.GetKeyDown(KeyCode.Alpha0 + i))
                {
                    Debug.Log("Select Level : " + i);
                    BeginNewGame();
                    StartCoroutine(LoadLevel(i));
                    return;
                }
            }
        }
    }