Пример #1
0
 public void StartConversation(Conversation conversation)
 {
     InGameEvents.OnDialogStartedFunction();
     UI_Base.Instance.DialogDisplayer.SetDialogBox(true);
     ConvertDialogsToQueue(conversation);
     conversationCoroutine = StartCoroutine(ConversationCoroutine());
 }
Пример #2
0
 public void Collect()
 {
     SoundManager.instance.PlaySingle(collectClip);
     InGameEvents.ItemCollected(this);
     Destroy(gameObject);
     GameManager.instance.AddFish(value);
 }
Пример #3
0
 public void Collect()
 {
     SoundManager.instance.PlaySingle(collectClip);
     InGameEvents.ItemCollected(this);
     Destroy(gameObject);
     temperature.LowerTemperature(temperatureAmount + 1 * GameManager.instance.GetUpgradeLevels(GameManager.Upgrade.snowflake));
 }
    public void Die()
    {
        Analytics.CustomEvent("Died at level ", new Dictionary <string, object>
        {
            { "level", (int)(transform.position.y / levelHeight) + 1 }
        });

        // Remove 1 life when the player dies

        /*
         * GameManager.instance.RemoveLives(1);
         * GameManager.instance.SaveProgress();
         */

        Time.timeScale     = 0;
        InGame.playerAlive = false;
        // Set the max travel distance on death
        Distance = (int)gameObject.transform.position.y;

        // Set playerAlive to false

        youDiedScreen.SetActive(false);
        gameOverScreen.SetActive(true);
        pauseButton.SetActive(false);

        GameManager.instance.SaveProgress();
        QuestManager.instance.UpdateQuests();

        InGameEvents.GameOver(this);

        Destroy(gameObject);
    }
Пример #5
0
 public void Use()
 {
     InGameEvents.ConsumableUsed(this);
     Count--;
     GameManager.instance.SetPowerupUses(GameManager.Consumable.bomb, Count);
     GameManager.instance.SaveProgress();
     UpdateDisplay();
 }
Пример #6
0
    public void BackToMainMenu()
    {
        InGameEvents.OnMainMenuButtonPressedFunction();
        PlayerController.Instance.ResetToDefaults();
        ObjectPooler.Instance.ReturnToPool(tmpPlayer.name, tmpPlayer);
        TimeManager.timeScale = 1;

        StartCoroutine(LoadSceneWithASyncCoroutine());
    }
    public void OnFadeOutFinished()
    {
        switch (sceneName)
        {
        case MAIN_MENU:
            break;

        case GAME:
            InGameEvents.OnGameStartFunction();
            break;

        default:
            break;
        }
    }
Пример #8
0
    IEnumerator ConversationCoroutine()
    {
        if (conversations.Count > 0)
        {
            ConversationHolder tmpConversationHolder = conversations.Dequeue();
            UI_Base.Instance.DialogDisplayer.SetConversationSettings(tmpConversationHolder.speaker.Icon, tmpConversationHolder.dialog);
        }
        else
        {
            InGameEvents.OnDialogEndedFunction();
            UI_Base.Instance.DialogDisplayer.SetDialogBox(false);
        }

        yield return(null);
    }
Пример #9
0
    public void UseItem()
    {
        if (Item != null)
        {
            Item.UseItem();

            if (Amount > 0)
            {
                Amount--;
            }

            RemoveItem();

            InGameEvents.OnInventoryModifiedFunction();
        }
    }
Пример #10
0
    // Snaps the blocks in place and they become fixed after that
    public void SnapBlock()
    {
        SoundManager.instance.PlaySnapIceBlockSoundClip();

        InGameEvents.IceBlockSnapped();
        // Destroy the rigidbody so that it won't move after it snapped
        Destroy(gameObject.GetComponent <Rigidbody2D>());
        //Debug.Log("Object Snapped");
        // Mark that hold has ended
        HoldEnded();
        // Debug.Log("SnappedBlock");
        for (int i = 0; i < transform.childCount; i++)
        {
            //Debug.Log(holograms[i].transform.position);
            Transform block = transform.GetChild(i);
            // Debug.Log(block);
            // Place each block in it's coresponding hologram position
            //block.position = holograms[i].transform.position;
            // Change the tag of each block to "FixedBlock"
            block.tag = "FixedBlock";
            block.GetComponent <BoxCollider2D>().size = new Vector2(1f, 1f);
        }
        // Destroy all the holograms
        foreach (GameObject o in holograms)
        {
            Destroy(o);
        }

        // Set animator to active
        if (!isExtraBlock && !isBomb)
        {
            GetComponent <Animator>().enabled = true;
        }

        // Activate the breaking of ice
        if (!isExtraBlock && !isBomb)
        {
            GetComponent <IceBlockLife>().PlayerOnTop();
        }
        // Center the object
        transform.position = new Vector3(Mathf.Round(transform.position.x), Mathf.Round(transform.position.y), transform.position.z);
        allowRotation      = false;
        holograms.Clear();

        // Begin breaking the iceBlock
        GetComponent <IceBlockLife>().PlayerOnTop();
    }
Пример #11
0
    public bool AddItem(Item item)
    {
        if (InventoryUI.Instance.IsInventoryFull() && Items.Contains(item) && item.stackable)
        {
            HandleItemAdd();
            return(true);
        }

        else if (InventoryUI.Instance.IsInventoryFull())
        {
            return(false);
        }

        HandleItemAdd();
        return(true);

        void HandleItemAdd()
        {
            Items.Add(item);
            Items.Sort();

            InGameEvents.OnInventoryModifiedFunction();
        }
    }
Пример #12
0
 public void Collect()
 {
     InGameEvents.ItemCollected(this);
     Destroy(gameObject);
 }
Пример #13
0
 public void Collect()
 {
     InGameEvents.ItemCollected(this);
     Destroy(gameObject);
     GameManager.instance.AddCandy(value);
 }
 public void OnContinueButtonPressed()
 {
     InGameEvents.OnDialogContinueButtonPressedFunction();
 }
Пример #15
0
 public void ClosePauseMenu()
 {
     pauseCanvas.enabled   = false;
     TimeManager.timeScale = 1;
     InGameEvents.OnGameContinueFunction();
 }
Пример #16
0
 public void OpenPauseMenu()
 {
     pauseCanvas.enabled   = true;
     TimeManager.timeScale = 0;
     InGameEvents.OnGamePausedFunction();
 }