示例#1
0
文件: Well.cs 项目: Vestrall/Taita
    //test
//	public Transform testBox;
//	IEnumerator testSpawner() {
//		yield return new WaitForSeconds(1);
//		for (int i = 0; i < 1000; i++) {
//			Transform transform = Instantiate(testBox);
//			BoxCollider[] boxColliders = transform.GetComponentsInChildren<BoxCollider>();
//			BoxCollider boxy = null;
//			foreach (BoxCollider bc in boxColliders) {
//				if (!bc.isTrigger) {
//					boxy = bc;
//					bc.enabled = false;
//				}
//			}
//			transform.GetComponent<Pickupable>().SetInteractionEnabled(false);
//			StartCoroutine(Reject(boxy));
//			yield return new WaitForSeconds(0.5F);
//		}
//	}

    private void NextMaterial()
    {
        if (colorOneCount <= 0 && colorTwoCount <= 0)
        {
            puzzleSolved = true;
            wellCenterRenderer.material = colorDeactivated;
            if (onSolveEvent != null)
            {
                onSolveEvent.Fire();
            }
        }
        else if (colorOneCount <= 0)
        {
            wellCenterRenderer.material = colorTwoMaterial;
            colorTwoCount--;
        }
        else if (colorTwoCount <= 0)
        {
            wellCenterRenderer.material = colorOneMaterial;
            colorOneCount--;
        }
        else if (Random.value > 0.5f)
        {
            wellCenterRenderer.material = colorTwoMaterial;
            colorTwoCount--;
        }
        else
        {
            wellCenterRenderer.material = colorOneMaterial;
            colorOneCount--;
        }
    }
示例#2
0
 private void NextScene()
 {
     if (onEvent != null)
     {
         onEvent.Fire();
     }
     else if (nextScene.Length > 0)
     {
         SceneManager.LoadScene(nextScene);
     }
     else
     {
         Debug.Log("Warning: SceneEnd executed with no OnEvent and no scene to transition to");
     }
 }
示例#3
0
    protected virtual IEnumerator ActivateColor()
    {
        solveInProgress = true;
        UpdateXAnimationVisibility();
        bool success = true;

        for (int i = 0; i < slaveCount; i++)
        {
            if (!slaves[i].ActivateColor())
            {
                success = false;
                hints[i].OnPuzzleFail();
            }
        }

        yield return(new WaitForSeconds(2));

        if (success)
        {
            foreach (ColorPuzzleHint hint in hints)
            {
                hint.OnPuzzleSuccess();
            }
            foreach (ColorPuzzleSlave slave in slaves)
            {
                slave.SetDisabled(true);
            }
            onSolveEvent.Fire();
            interactionEnabled = false;
        }
        else
        {
            foreach (ColorPuzzleSlave slave in slaves)
            {
                slave.OnPuzzleFail(resetOnFail);
            }
        }
        solveInProgress = false;
        UpdateXAnimationVisibility();
    }