Пример #1
0
    IEnumerator Shake()
    {
        // dont' shake when pause, or cut scene
        if (FMGameLoopManager.GetOrCreateInstance().m_IsPaused || Time.timeScale == 0.0)
        {
            yield break;
        }

        isRunning = true;
        var before_shake_rotation = target_camera.transform.localRotation;

        while (shakeDuration > 0.01f)
        {
            Vector3 rotationAmount = Random.insideUnitSphere * shakeAmount; //A Vector3 to add to the Local Rotation
            rotationAmount.z = 0;                                           //Don't change the Z; it looks funny.

            shakePercentage = shakeDuration / startDuration;                //Used to set the amount of shake (% * startAmount).

            shakeAmount   = startAmount * shakePercentage;                  //Set the amount of shake (% * startAmount).
            shakeDuration = Mathf.Lerp(shakeDuration, 0, Time.deltaTime);   //Lerp the time, so it is less and tapers off towards the end.


            if (smooth)
            {
                target_camera.transform.localRotation = Quaternion.Lerp(target_camera.transform.localRotation, Quaternion.Euler(rotationAmount), Time.deltaTime * smoothAmount);
            }
            else
            {
                target_camera.transform.localRotation = before_shake_rotation * Quaternion.Euler(rotationAmount);//Set the local rotation the be the rotation amount.
            }
            yield return(null);
        }
        target_camera.transform.localRotation = before_shake_rotation;//Quaternion.identity;//Set the local rotation to 0 when done, just to get rid of any fudging stuff.
        isRunning = false;
    }
Пример #2
0
 private void Update()
 {
     if (!m_ShowingMafia && (Time.time - m_LastMafiaSpawnTime > m_TimeToSpawnMafia) &&
         !FMGameLoopManager.GetOrCreateInstance().m_IsPaused)
     {
         StartCoroutine(SpawnMafia());
     }
 }
Пример #3
0
    private void Update()
    {
        var time_of_day = FMGameLoopManager.GetOrCreateInstance().m_CurrentDay.GetTimeOfDay();

        if (m_IsSleepingIn && time_of_day != FMDay.TimeOfDay.Evening && time_of_day != FMDay.TimeOfDay.Night)
        {
            TickReturnToWork(Time.deltaTime);
        }
    }
Пример #4
0
    public void IncrementCapital(float value)
    {
        m_Capital += value;
        OnCapitalIncrease?.Invoke(value);

        if (m_Capital <= 0f && !m_game_over)
        {
            Time.timeScale = 0f;
            m_game_over    = true;
            m_Capital      = 0f;
            FMGameLoopManager.GetOrCreateInstance().PauseGame(true);
            DialogManager.Get().Say_2D("[audio:yourtime]Your time is up my friend...", "DialogMafia", true);
            DialogManager.Get().Say_2D("[audio:igave]I gave you a chance to make things right...", "DialogMafia", true);
            DialogManager.Get().Say_2D("[audio:butyou]... But you've Haddock.", "DialogMafia", true);
            DialogManager.Get().Say_2D("[audio:itstime]It's time you go back to sleeping with the fishes.", "DialogMafia", true);
            DialogManager.Get().Say_2D("[audio:boysfeed]Boys! Feed him to the dog fish...", "DialogMafia", true);

            StartCoroutine(DoCoroutine());
        }
    }
Пример #5
0
    protected override void OnStart()
    {
        base.OnStart();

        var startingResource = FMBoardReferences.GetOrCreateInstance().m_ResourcePrefabs[m_ResourceIndex];
        var canvas           = GetComponentInParent <Canvas>();
        var initialResource  = Instantiate(startingResource, canvas.transform);

        initialResource.transform.localScale = Vector3.one;
        initialResource.transform.position   = transform.position;

        var resourceComponent = initialResource.GetComponent <FMResource>();

        resourceComponent.SetResourceVisible(false);
        resourceComponent.m_ProcessedAmount = FMResource.m_StartingResourceAmount;
        m_Resources.Enqueue(resourceComponent);
        m_SinkLevelDisplay.UpdateLevelDisplay(FMResource.m_StartingResourceAmount);

        FMGameLoopManager.GetOrCreateInstance().m_CurrentDay.m_OnDayStartEvent += OnDayStart;

        //TODO: Add a decent level of starting resources for the player to make money off
    }
Пример #6
0
 void Awake()
 {
     m_day = FMGameLoopManager.GetOrCreateInstance().m_CurrentDay;
 }
Пример #7
0
 void Awake()
 {
     FMGameLoopManager.GetOrCreateInstance().m_CurrentDay.m_OnMorningStartEvent += OnSpawnMore;
 }
Пример #8
0
 protected virtual void OnStart()
 {
     FMGameLoopManager.GetOrCreateInstance().m_CurrentDay.m_OnEveningStartEvent += OnEveningStart;
     fillerImage.fillAmount = 0f;
 }
Пример #9
0
 private void OnDisable()
 {
     FMGameLoopManager.GetOrCreateInstance().m_TickableTasks.Remove(this);
 }
Пример #10
0
 private void OnEnable()
 {
     FMGameLoopManager.GetOrCreateInstance().m_TickableTasks.Add(this);
 }
Пример #11
0
 private void Start()
 {
     FMGameLoopManager.GetOrCreateInstance().m_CurrentDay.m_OnEveningStartEvent += OnEveningStart;
     FMGameLoopManager.GetOrCreateInstance().m_CurrentDay.m_OnDayEndEvent += OnDayEnd;
 }