Ejemplo n.º 1
0
    public void MovePlayerTo()
    {
        playerSpriteRenderer.enabled = true;
        playerSpriteRenderer.sprite  = mainGraphic;
        Stats     s = (Stats)DayManager.Instance.DedicatedStatIndex;
        Transform t = null;

        switch (s)
        {
        case Stats.SOCIAL:
            t = doorTransform;
            break;

        case Stats.SLEEP:
            t = bedTransform;
            break;

        case Stats.SUCCESS:
            t = deskTransform;
            break;

        default:
            t = doNothingTransform;
            break;
        }

        CoroutineManager.BeginCoroutine(LerpTo(playerTransform, t.position, 1.0f, s), ref cr_Moving, this);
    }
 public void SetEvent(GameEvent ev)
 {
     eventNameText.text        = ev.eventName;
     eventDescriptionText.text = ev.description;
     img.color = GameEventManager.Instance.GetEventColour(ev.colourClassification);
     CoroutineManager.BeginCoroutine(CoroutineManager.ShrinkScaleFrom(transform, popInSize, Vector3.one, popInTime), ref cr_Scale, this);
 }
Ejemplo n.º 3
0
        private IEnumerator UpdateDistanceText()
        {
            WaitForSeconds wfs = new WaitForSeconds(0.2f);

            while (true)
            {
                yield return(wfs);

                for (int i = 0; i < PlayerManager.PlayerCount; i++)
                {
                    Player p        = PlayerManager.GetPlayer(i);
                    float  distance = p.transform.position.x;

                    distanceTexts[i].text = distance.ToString("F2") + "m";

                    progressSliders[i].value = distance;

                    if (p.CurrentVelocity == 0.0f && cr_ResetTimers[i] == null)
                    {
                        if (p.CurrentState == Player.PlayerStates.PLAYING)
                        {
                            CoroutineManager.BeginCoroutine(ResetTimer(i), ref cr_ResetTimers[i], this);
                        }
                    }
                    else if (p.CurrentVelocity > 0.0f && cr_ResetTimers[i] != null)
                    {
                        CoroutineManager.HaltCoroutine(ref cr_ResetTimers[i], this);
                    }
                }
            }
        }
 public void SetTimeOfDay(TimeOfDay tod)
 {
     currentTimeOfDay_   = tod;
     dayLabel.text       = "Day " + currentDay_.ToString();
     dayTimeImage.sprite = dayTimeImages[(int)currentTimeOfDay_];
     CoroutineManager.BeginCoroutine(CoroutineManager.ShrinkScaleFrom(dayTimeImage.transform, new Vector3(1.5f, 1.5f, 1.0f), Vector3.one, 0.25f), ref cr_DayTimeImage, this);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the label of the timer to reflect the time remaining. If withAnimation is true, will pulse with the change.
 /// </summary>
 /// <param name="text">What should the label read?</param>
 /// <param name="withAnimation">Should the new text animate?</param>
 public void SetLabelText(string text, bool withAnimation = true)
 {
     timerText.text = text;
     if (withAnimation)
     {
         CoroutineManager.BeginCoroutine(CoroutineManager.ShrinkScaleFrom(timerTextTransform, new Vector3(2.0f, 2.0f, 2.0f), Vector3.one, 1.0f), ref cr_TextScaling, this);
     }
 }
Ejemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     cr_BeginPlayTimers = new Coroutine[PlayerManager.PlayerCount];
     for (int i = 0; i < PlayerManager.PlayerCount; i++)
     {
         CoroutineManager.BeginCoroutine(BeginPlayTimer(i), ref cr_BeginPlayTimers[i], this);
     }
 }
Ejemplo n.º 7
0
        private IEnumerator WaitThenMove()
        {
            transform.position           = startPosition;
            outline.transform.localScale = new Vector3(3.0f / PlayerManager.PlayerCount, 3.0f / PlayerManager.PlayerCount, 1);
            yield return(new WaitForSeconds(1.0f));

            CoroutineManager.BeginCoroutine(CREffects.ZoomToScale(outline.transform, outline.transform.localScale, Vector3.one, 0.2f), ref cr_Achievement, this);
            CoroutineManager.BeginCoroutine(CREffects.ZoomToPosition(transform, transform.position, homePosition, 0.2f), ref cr_MovePos, this);
        }
Ejemplo n.º 8
0
 public void BeginPlay()
 {
     myCurrentState = PlayerStates.PLAYING;
     SetCurrentFunds(_runStartFunds * GetLevel());
     pc.Propel(initialForce);
     audioSource.clip = launch;
     audioSource.Play();
     handleInput = true;
     CoroutineManager.BeginCoroutine(CheckAchievementsRoutine(), ref cr_AchievementChecker, this);
 }
Ejemplo n.º 9
0
 public void Achieve()
 {
     if (achieved)
     {
         return;
     }
     achieved              = true;
     outline.color         = achievedColour;
     plaque.color          = plaque.color = new Color(plaque.color.r, plaque.color.g, plaque.color.b, 1.0f);
     actualGraphic.enabled = true;
     CoroutineManager.BeginCoroutine(WaitThenMove(), ref cr_waitTimer, this);
 }
Ejemplo n.º 10
0
        // Start is called before the first frame update
        void Start()
        {
            for (int i = 0; i < PlayerManager.PlayerCount; i++)
            {
                PlayerManager.GetPlayer(i).FundsChanged += Player_FundsChanged;
            }
            CoroutineManager.BeginCoroutine(UpdateDistanceText(), ref cr_DistanceTimer, this);

            for (int i = 0; i < PlayerManager.PlayerCount; i++)
            {
                highImpactTexts[i].ResetText();
                highImpactTexts[i].gameObject.SetActive(false);
                lowImpactTexts[i].ResetText();
                lowImpactTexts[i].gameObject.SetActive(false);
            }


            if (cr_ResetTimers == null || cr_ResetTimers.Length != PlayerManager.PlayerCount)
            {
                cr_ResetTimers = new Coroutine[PlayerManager.PlayerCount];
            }
        }
Ejemplo n.º 11
0
 private void DelegateMethod()
 {
     Debug.Log("Test Item 1: GameObject Enabled: " + objectToShow.activeSelf.ToString());
     CoroutineManager.BeginCoroutine(CREffects.SetActiveAfterDelay(objectToShow, !objectToShow.activeSelf, 2.0f, DelegateMethod), ref cr_Appear, this);
 }
Ejemplo n.º 12
0
 public void ResetRun(int playerIndex)
 {
     OnRunReset(playerIndex);
     CoroutineManager.BeginCoroutine(BeginPlayTimer(playerIndex), ref cr_BeginPlayTimers[playerIndex], this);
     _currentState = GameStates.PRE_PLAY;
 }
Ejemplo n.º 13
0
 void StartFadeIn()
 {
     CoroutineManager.BeginCoroutine(Fade(1.0f, 1.0f), ref cr_FadeIn, this);
 }
Ejemplo n.º 14
0
 public void Victory()
 {
     CoroutineManager.BeginCoroutine(VictoryScreen(), ref cr_EndScreen, this);
 }
Ejemplo n.º 15
0
 public void BeginAnimate()
 {
     CoroutineManager.BeginCoroutine(LifeTime(), ref cr_Animation, this);
 }
Ejemplo n.º 16
0
 private void DelegateMethod()
 {
     Debug.Log("Test Item 2: Behaviour Enabled: " + behaviourToShow.enabled.ToString());
     CoroutineManager.BeginCoroutine(CREffects.SetActiveAfterDelay(behaviourToShow, !behaviourToShow.enabled, 2.0f, DelegateMethod), ref cr_Appear, this);
 }
Ejemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     CoroutineManager.BeginCoroutine(CREffects.ZoomToScale(transformToZoom, initialScale, targetScale, zoomTime, DelegateMethod), ref cr_ScaleZoom, this);
 }
Ejemplo n.º 18
0
 private void DelegateMethod()
 {
     Debug.Log("Test Item 3: Particles Enabled: " + ps.emission.enabled.ToString());
     CoroutineManager.BeginCoroutine(CREffects.SetActiveAfterDelay(ps, !ps.emission.enabled, 2.0f, DelegateMethod), ref cr_Appear, this);
 }
Ejemplo n.º 19
0
 private void DelegateMethod()
 {
     Debug.Log("Test Item 5: Zooming to scale: " + targetScale.ToString());
     CoroutineManager.BeginCoroutine(CREffects.SmoothZoomToScale(transformToZoom, initialScale, targetScale, smoothTime, maxSpeed, scaleError, DelegateMethod), ref cr_ScaleZoom, this);
 }
Ejemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     CoroutineManager.BeginCoroutine(CREffects.SmoothZoomToScale(transformToZoom, initialScale, targetScale, smoothTime, maxSpeed, scaleError, DelegateMethod), ref cr_ScaleZoom, this);
 }
Ejemplo n.º 21
0
 // Use this for initialization
 void Start()
 {
     objectToShow.SetActive(false);
     CoroutineManager.BeginCoroutine(CREffects.SetActiveAfterDelay(objectToShow, true, 2.0f, DelegateMethod), ref cr_Appear, this);
 }
Ejemplo n.º 22
0
 private void GameManager_CurtainOpened(object sender, EventArgs e)
 {
     CoroutineManager.BeginCoroutine(StartDayTimer(), ref cr_BeginDay, this);
 }
Ejemplo n.º 23
0
 // Use this for initialization
 void Start()
 {
     behaviourToShow.enabled = false;
     CoroutineManager.BeginCoroutine(CREffects.SetActiveAfterDelay(behaviourToShow, true, 2.0f, DelegateMethod), ref cr_Appear, this);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Starts the timer.
 /// </summary>
 public void StartTimer()
 {
     CoroutineManager.BeginCoroutine(RunTimer(startFromTime), ref cr_timerRunning, this);
 }
Ejemplo n.º 25
0
 public void FadeTo(float alpha)
 {
     CoroutineManager.BeginCoroutine(Fade(alpha, 1.0f), ref cr_Fade, this);
 }
Ejemplo n.º 26
0
 public void LoadScene(string str)
 {
     CoroutineManager.BeginCoroutine(SceneTransition(str), ref cr_Transitoning, this);
 }
Ejemplo n.º 27
0
 public void LoadScene(string scene)
 {
     sceneToLoad = scene;
     CoroutineManager.BeginCoroutine(FadeCurtainTo(1.0f, 1.0f), ref cr_FadeCurtain, this);
     CurtainClosed += LoadSceneFromEvent;
 }
Ejemplo n.º 28
0
 // Use this for initialization
 void Start()
 {
     ParticleSystem.EmissionModule em = ps.emission;
     em.enabled = false;
     CoroutineManager.BeginCoroutine(CREffects.SetActiveAfterDelay(ps, true, 2.0f, DelegateMethod), ref cr_Appear, this);
 }
Ejemplo n.º 29
0
 private void DelegateMethod()
 {
     Debug.Log("Test Item 4: Zooming to scale: " + targetScale.ToString());
     CoroutineManager.BeginCoroutine(CREffects.ZoomToScale(transformToZoom, initialScale, targetScale, zoomTime, DelegateMethod), ref cr_ScaleZoom, this);
 }
Ejemplo n.º 30
0
 private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
 {
     CoroutineManager.BeginCoroutine(FadeCurtainTo(0, 1.0f), ref cr_FadeCurtain, this);
 }