示例#1
0
    public void SetupData()
    {
        Debug.Log("SettingData");
        playerColors[0] = Color.green;
        playerColors[1] = Color.red;
        playerColors[2] = Color.blue;
        playerColors[3] = Color.magenta;

        if (levelCompleted == null)
        {
            if (Resources.Load <ILevelCompleted>("Alex/WinConditions/Data/" + SceneManager.GetActiveScene().name + "WinCondition") != null)
            {
                levelCompleted = Resources.Load <ILevelCompleted>("Alex/WinConditions/Data/" + SceneManager.GetActiveScene().name + "WinCondition");
            }
            else
            {
                levelCompleted = null;
            }
        }
        if (thisScenePlayerMovement == null)
        {
            if (Resources.Load <IPlayerMovement>("Alex/PlayerMovement/PlayerMovementObjects/" + SceneManager.GetActiveScene().name + "Movement") != null)
            {
                thisScenePlayerMovement = Resources.Load <IPlayerMovement>("Alex/PlayerMovement/PlayerMovementObjects/" + SceneManager.GetActiveScene().name + "Movement");
            }
            else
            {
                thisScenePlayerMovement = null;
            }
        }
        if (thisScnenePlayerInteractions == null)
        {
            if (Resources.Load <IPlayerInteractions>("Alex/InteractionData/InteractionDataObjects/" + SceneManager.GetActiveScene().name + "Interaction") != null)
            {
                thisScnenePlayerInteractions = Resources.Load <IPlayerInteractions>("Alex/InteractionData/InteractionDataObjects/" + SceneManager.GetActiveScene().name + "Interaction");

                if (Resources.Load <ISensor>("Alex/SensorData/SensorObjects/" + SceneManager.GetActiveScene().name + "Sensor") != null)
                {
                    thisScnenePlayerInteractions.sensor = Resources.Load <ISensor>("Alex/SensorData/SensorObjects/" + SceneManager.GetActiveScene().name + "Sensor");
                }
                else
                {
                    thisScnenePlayerInteractions.sensor = null;
                }
            }
            else
            {
                thisScnenePlayerInteractions = null;
            }
        }
    }
示例#2
0
 public void StartChangingScene()
 {
     completed = FindObjectOfType <SceneLoader>().myCurrentData.levelCompleted;
     if (completed.WinConditionMet())
     {
         fader.color += Color.Lerp(new Color(0, 0, 0, 0), new Color(0, 0, 0, 1), Mathf.PingPong(Time.deltaTime, 1));
         if (fader.color.a >= 2.5f && completed.allowChange == 0)
         {
             ChangeScene();
         }
     }
     else
     {
     }
 }
示例#3
0
 private void Awake()
 {
     completed = FindObjectOfType <SceneLoader>().myCurrentData.levelCompleted;
     completed.OnAwake();
 }