Transition script.
Наследование: MonoBehaviour
Пример #1
0
    private IEnumerator DoPlay(TransitionScript script, Action callback)
    {
        _transitionUi.subtitleText = string.Empty;
        _transitionUi.SetVisible(true);
        var musicVolume = AudioManager.Music.volume;

        while (AudioManager.Music.volume > musicVolume / 4)
        {
            AudioManager.Music.volume -= Time.deltaTime * musicVolume;
            yield return(null);
        }
        foreach (var step in script.steps)
        {
            var stepAudio = AudioManager.Voice.Play(step.audio);
            _transitionUi.subtitleText = step.subtitles;
            while (stepAudio.isPlaying)
            {
                yield return(null);
            }
            yield return(new WaitForSeconds(.2f));
        }
        _transitionUi.SetVisible(false);
        while (AudioManager.Music.volume < musicVolume)
        {
            AudioManager.Music.volume += 3 * Time.deltaTime * musicVolume;
            yield return(null);
        }
        AudioManager.Music.volume = musicVolume;
        callback?.Invoke();
    }
Пример #2
0
 internal void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #3
0
    void Awake()
    {
        //Try to get the TransitionScript script by locating the GameplayCanvas object.
        try
        {
            TS = GameObject.Find("GameplayCanvas").GetComponent <TransitionScript>();
        }
        catch
        {
            TS = null;
        }

        //Get the HealthScript by locating the Diamonds/Hitpoints object.
        try
        {
            HS = GameObject.Find("Diamonds/Hitpoints").GetComponent <HealthScript>();
        }
        catch
        {
            HS = null;
        }

        //Get the LevelManager Script from the LM tagged object
        try
        {
            LM = GameObject.FindWithTag("LM").GetComponent <LevelManager>();
        }
        catch
        {
            LM = null;
        }
    }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     mainCam  = Camera.main;
     tsScript = FindObjectOfType <TransitionScript>();
     rsScript = FindObjectOfType <RotatePlanet>();
     StartCoroutine(tsScript.FadeImg());
     Screen.orientation = ScreenOrientation.LandscapeLeft;
 }
 // Use this for initialization
 void Start()
 {
     transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
     cameraTrack = false;
     isActive = false;
     animator = GetComponent<Animator>();
     xScale = transform.localScale.x;
     startPos = transform.position;
 }
Пример #6
0
    public bool goToNextLevel()
    {
        bool rc = true;

        //int currentLevel = Utility.CurrentSceneIndex;
        //int courseLevel = getHoleNomUsingCourse();
        int courseLevel  = getHoleNomUsingCourse();
        int currentLevel = m_courceController.currentHoleIndex;

        updateScores(courseLevel);

        TransitionScript ts = (TransitionScript)GameObject.FindObjectOfType(typeof(TransitionScript));

        Constants.setLastSceneIndex(currentLevel + 1);

        if (courseLevel + 1 < HOLES_PER_COURSE + 1)
        {
            GameManager.nextScene();

            /*
             * if (ts)
             * {
             *  loadLevel(ts.sceneIndex);
             * }
             * else
             * {
             *  loadLevel(currentLevel + 1);
             * }
             */
            m_courceController.LoadNextHole();
            currentNumberOfStrokes = 0;
            //get a ref to the gamescript!
            GameObject go = GameObject.FindWithTag("Player");
            if (go)
            {
                m_ballScript = go.GetComponent <BallScript>();
            }
            BaseGameManager.gameover(false);

            GolfManager.startHole();
        }
        else
        {
            if (Constants.getPracticeMode() == false)
            {
                BaseGameManager.submitSate();
                GameManager.enterState(GameScript.State.SUBMTSCORE.ToString());
            }
            else
            {
                loadLevel(0);
            }
            rc = false;
        }
        return(rc);
    }
Пример #7
0
 private void Awake()
 {
     if (Instance != null)
     {
         return;
     }
     Instance  = this;
     _image    = GetComponent <Image>();
     _material = _image.material;
 }
Пример #8
0
    private void OnLoadingError()
    {
        Loading.OnComplete -= OnLoadingComplete;
        Loading.OnError    -= OnLoadingError;

        //here we will start with default game values!
        TransitionScript.OnComplete += () =>
        {
            TransitionScript.RemoveEvents();
            loading.Hide();
            InitializeGame();
            TransitionScript.Instance.FadeOut(transitionSpeed);
        };
        TransitionScript.Instance.FadeIn(transitionSpeed);
    }
Пример #9
0
    private void OnLoadingComplete(GameData data)
    {
        Loading.OnComplete -= OnLoadingComplete;
        Loading.OnError    -= OnLoadingError;
        this.gameData       = data;

        TransitionScript.OnComplete += () =>
        {
            TransitionScript.RemoveEvents();
            loading.Hide();
            InitializeGame();
            TransitionScript.Instance.FadeOut(transitionSpeed);
        };
        TransitionScript.Instance.FadeIn(transitionSpeed);
    }
Пример #10
0
    public bool goToNextLevel()
    {
        bool rc           = true;
        int  currentLevel = Application.loadedLevel;

        int courseLevel = getHoleNomUsingCourse();

        Debug.Log("courseLevel" + courseLevel);
        updateScores(courseLevel);

        TransitionScript ts = (TransitionScript)GameObject.FindObjectOfType(typeof(TransitionScript));

        Constants.setLastSceneIndex(currentLevel + 1);

        if (courseLevel + 1 < HOLES_PER_COURSE + 1)
        {
            GameManager.nextScene();
            if (ts)
            {
                loadLevel(ts.sceneIndex);
                //Application.LoadLevel(ts.sceneIndex);
            }
            else
            {
                loadLevel(currentLevel + 1);
                //Application.LoadLevel( currentLevel+1 );
            }
        }
        else
        {
            if (Constants.getPracticeMode() == false)
            {
                BaseGameManager.submitSate();
                GameManager.enterState(GameScript.State.SUBMTSCORE.ToString());
            }
            else
            {
                loadLevel(0);
            }
            rc = false;
        }
        return(rc);
    }
Пример #11
0
 public static void Play(TransitionScript script, Action callback = null, float delayBeforeCallbackOnNoPlay = 0f)
 {
     if (!script || instance.transitionsToSkip.Contains(script))
     {
         if (callback != null)
         {
             instance.StartCoroutine(WaitAndCall(callback, delayBeforeCallbackOnNoPlay));
         }
     }
     else
     {
         if (instance.coroutine != null)
         {
             instance.StopCoroutine(instance.coroutine);
         }
         instance.coroutine = instance.StartCoroutine(instance.DoPlay(script, callback));
         instance.transitionsToSkip.Add(script);
     }
 }
    // Update is called once per frame
    void Update()
    {
        //Get middle of the screen
        int x = Screen.width / 2;
        int y = Screen.height / 2;

        Ray InteractableRay = camera.ScreenPointToRay(new Vector3(x, y, 0));

        RaycastHit hit;

        //Cast on all "Items" (layer 10)
        if (Physics.Raycast(InteractableRay, out hit, 5, 1 << 10))
        {
            //All Items should use IInteractable interface, and implement LookAt and Interact functions.
            IInteractable obj = hit.transform.gameObject.GetComponent <IInteractable>();
            obj.LookAt();
            if (Input.GetButtonDown("Use"))
            {
                obj.Interact();
            }
        }
        else
        //Cast on all transition items (layer 8)
        if (Physics.Raycast(InteractableRay, out hit, 5, 1 << 8))
        {
            //All transition items will have TransitionScript, so we grab that script and execute it's functions.
            TransitionScript obj = hit.transform.gameObject.GetComponent <TransitionScript>();
            obj.AimAt();
            if (Input.GetButtonDown("Use"))
            {
                obj.Interact();
            }
        }
        else         //if we haven't hit anything, clear the string so we don't have leftover messages when not aiming at anything.
        {
            HUDScript.AimedObjectString = "";
        }
    }
    // Use this for initialization
    void Start()
    {
        transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
        eventManager = GameObject.FindGameObjectWithTag("EventManager").GetComponent<EventManagerScript>();
        ArrayList temp = new ArrayList();
        for(int i = 0; i < transform.childCount; i++){
            if(transform.GetChild(i).GetComponent<PersonScript>().isFamily){
                temp.Add(transform.GetChild (i).gameObject);
            }
        }
        family = new PersonScript[temp.Count];
        for(int i = 0; i < temp.Count; i++){
            family[i] = ((GameObject)temp[i]).GetComponent<PersonScript>();
        }

        temp = new ArrayList();
        for(int i = 0; i < transform.childCount; i++){
            if(!transform.GetChild(i).GetComponent<PersonScript>().isFamily){
                temp.Add(transform.GetChild (i).gameObject);
            }
        }
        jews = new PersonScript[temp.Count];
        for(int i = 0; i < temp.Count; i++){
            jews[i] = ((GameObject)temp[i]).GetComponent<PersonScript>();
        }
    }
    // Use this for initialization
    void Start()
    {
        transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
        input = GetComponent<InputManagerScript>();

        GameObject go;

        for(int i = 0; i < startingPastries.Length; i++){
            go = (GameObject)Instantiate(startingPastries[i]);
            go.transform.position = new Vector3(999f, 999f, 999f);
            inventory.Add (go);
        }

        bottom = Mathf.Min (inventory.Count, 6);
    }
 // Use this for initialization
 void Start()
 {
     transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
     eventManager = GameObject.FindGameObjectWithTag("EventManager").GetComponent<EventManagerScript>();
     input = GameObject.Find ("EventManager").GetComponent<InputManagerScript>();
     inventory = GameObject.Find ("EventManager").GetComponent<InventoryScript>();
     currentPosition = start.GetComponent<ItemPositionScript>();
     positions = new ItemPositionScript[transform.childCount];
     for(int i = 0; i < transform.childCount; i++){
         positions[i] = transform.GetChild (i).GetComponent<ItemPositionScript>();
     }
 }
 // Use this for initialization
 void Start()
 {
     slides = GetComponent<SlidesScript>();
     slides.starting = false;
     familyManager = GameObject.FindGameObjectWithTag("FamilyManager").GetComponent<FamilyManagerScript>();
     itemPosManager = GameObject.FindGameObjectWithTag("ItemPositions").GetComponent<ItemPositionManagerScript>();
     transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>();
     walkHome = GameObject.FindGameObjectWithTag("WalkHome").GetComponent<SideScrollWalkScript>();;
     audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManagerScript>();
     baking = GetComponent<BakingScript>();
     finances = GetComponent<FinancesScript>();
     customerManager = GetComponent<CustomerManagerScript>();
     conversationManager = GetComponent<ConversationManagerScript>();
     inventory = GetComponent<InventoryScript>();
     input = GetComponent<InputManagerScript>();
     phase = "setup";
     dailyTransactions = new Transaction[customersToday];
 }