Exemplo n.º 1
0
 private void Start()
 {
     this.upgrades      = GameObject.Find("UpgradesManager").GetComponent <UpgradesManager>();
     this.player        = GameObject.Find("Player").GetComponent <PlayerScript>();
     this.goldReference = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();
     this.assets        = GameObject.Find("AssetManager").GetComponent <AssetManager>();
 }
Exemplo n.º 2
0
    /// <summary>
    /// handles the sound of losing the game.  Also clears out all inventory,
    /// and closes any other canvases in order to display the game over screen
    /// correctly.
    /// </summary>
    public void GameOver()
    {
        SceneManager.LoadScene("GameOver");

        this.load = GameObject.Find("Loader").GetComponent <LoadingDontDestroy>();
        this.load.GetGoing();

        this.player          = GameObject.Find("Player");
        this.playerSprite    = this.player.GetComponent <SpriteRenderer>();
        this.inventoryScript = this.player.GetComponent <Inventory>();
        this._goldReference  = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();
        this.inventoryCanvas = GameObject.Find("Inventory").GetComponent <Canvas>();
        this.upgradesCanvas  = GameObject.Find("UpgradesManager").GetComponent <Canvas>();
        this.playerScript    = this.player.GetComponent <PlayerScript>();
        this.playerScript.PlayLoseSound();


        this.playerSprite.enabled = false;

        for (int i = 0; i < this.inventoryScript.slots.Length; i++)
        {
            if (this.inventoryScript.isfull[i] == true)
            {
                this.inventoryScript.isfull[i] = false;
                foreach (Transform child in this.inventoryScript.slots[i].transform)
                {
                    Destroy(child.gameObject);
                }
            }
        }

        this.inventoryCanvas.enabled = false;
        this.upgradesCanvas.enabled  = false;
        this._goldReference.AndroidControls.SetActive(false);
    }
 private void Start()
 {
     this._goldReference = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();
     this.rb             = this.GetComponent <Rigidbody2D>();
     this.bc2d           = this.GetComponent <BoxCollider2D>();
     this.target         = GameObject.FindGameObjectWithTag("Player");
     this.playerScript   = this.target.GetComponent <PlayerScript>();
     this.canMove        = false;
 }
Exemplo n.º 4
0
 private void Start()
 {
     this.player                  = GameObject.Find("Player");
     this.inventoryScript         = this.player.GetComponent <Inventory>();
     this.playerSprite            = this.player.GetComponent <SpriteRenderer>();
     this.playerScript            = this.player.GetComponent <PlayerScript>();
     this.inventoryCanvas         = GameObject.Find("Inventory").GetComponent <Canvas>();
     this.upgradesCanvas          = GameObject.Find("UpgradesManager").GetComponent <Canvas>();
     this.goldCanvas              = GameObject.Find("Gold Canvas").GetComponent <Canvas>();
     this.exitScreen              = GameObject.Find("MenuCanvas").GetComponent <Canvas>();
     this._goldReference          = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();
     this.load                    = GameObject.Find("Loader").GetComponent <LoadingDontDestroy>();
     this.playerSprite.enabled    = false;
     this.inventoryCanvas.enabled = false;
     this.upgradesCanvas.enabled  = false;
     this.exitScreen.enabled      = false;
     this.hasStaff                = false;
     this.menuOpen                = false;
 }
Exemplo n.º 5
0
    /// <summary>
    /// returns player to max health, and set player at the beginning
    /// of the dungeon.
    /// </summary>
    public void Restart()
    {
        this.load = GameObject.Find("Loader").GetComponent <LoadingDontDestroy>();
        this.load.GetGoing();

        this.player          = GameObject.Find("Player");
        this.playerSprite    = this.player.GetComponent <SpriteRenderer>();
        this.playerScript    = this.player.GetComponent <PlayerScript>();
        this.inventoryCanvas = GameObject.Find("Inventory").GetComponent <Canvas>();
        this.upgradesCanvas  = GameObject.Find("UpgradesManager").GetComponent <Canvas>();
        this._goldReference  = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();

        this.playerSprite.enabled = true;
        this.playerScript.ChangeHealth(this.playerScript.maxHealth);
        this.inventoryCanvas.enabled = true;
        this.upgradesCanvas.enabled  = false;
        this._goldReference.healthBar.SetActive(true);
        this._goldReference.AndroidControls.SetActive(true);

        SceneManager.LoadScene("Dungeon");
    }
 private void Start()
 {
     this.rigidbody2d = this.gameObject.GetComponent <Rigidbody2D>();
     this.defenseGlow.SetActive(false);
     this.strengthGlow.SetActive(false);
     this.currentHealth  = this.maxHealth;
     this._goldReference = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();
     this._goldReference.healthBar.SetActive(false);
     this._goldReference.AndroidControls.SetActive(false);
     this._goldReference.SetValue("HP", 1);
     this._assetManagerReference = GameObject.Find("AssetManager").GetComponent <AssetManager>();
     this.defensePercent         = 0.9f;
     this.defenseRaw             = 0;
     this.defensePotion          = 2;
     this.attackPotion           = 2;
     this.breadHeal      = 15;
     this.appleHeal      = 5;
     this.potionDuration = 30;
     this.appleDefense   = 0;
     this.attackLow      = 3;
     this.attackHigh     = 5;
     this.moved          = false;
 }
Exemplo n.º 7
0
    /// <summary>
    /// resets all stats to original values.
    /// </summary>
    public void ResetAllStats()
    {
        this.load = GameObject.Find("Loader").GetComponent <LoadingDontDestroy>();
        this.load.GetGoing();

        this.upgrades       = GameObject.Find("UpgradesManager").GetComponent <UpgradesManager>();
        this._goldReference = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();

        this.playerScript.maxHealth      = 30;
        this.playerScript.attackLow      = 3;
        this.playerScript.attackHigh     = 5;
        this.playerScript.defensePercent = .9f;
        this.playerScript.defenseRaw     = 0;
        this.playerScript.defensePotion  = 2;
        this.playerScript.attackPotion   = 2;
        this.playerScript.breadHeal      = 15;
        this.playerScript.appleHeal      = 5;
        this.playerScript.potionDuration = 30;
        this.playerScript.appleDefense   = 0;
        this.upgrades.ResetValues();
        this._goldReference.ChangeGoldDisplay(GoldDontDestroy.gold * -1);
        this._goldReference.SetValue("HP", 1);

        SceneManager.LoadScene("HomeScreen");

        this.player          = GameObject.Find("Player");
        this.playerSprite    = this.player.GetComponent <SpriteRenderer>();
        this.inventoryCanvas = GameObject.Find("Inventory").GetComponent <Canvas>();
        this.upgradesCanvas  = GameObject.Find("UpgradesManager").GetComponent <Canvas>();
        this.goldCanvas      = GameObject.Find("Gold Canvas").GetComponent <Canvas>();

        this.playerSprite.enabled    = false;
        this.inventoryCanvas.enabled = false;
        this.upgradesCanvas.enabled  = false;
        this.goldCanvas.enabled      = true;
    }
Exemplo n.º 8
0
 private void Start()
 {
     this._goldReference = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();
 }
 private void Start()
 {
     this._playerReference = GameObject.Find("Player").GetComponent <PlayerScript>();
     this._goldReference   = GameObject.Find("Gold Canvas").GetComponent <GoldDontDestroy>();
 }