Пример #1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Пример #2
0
    //what happens when certain enemy dies
    public override void Die()
    {
        if (tag == "Boss")
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
        }
        else
        {
            base.Die();
            if (tag == "SpiderQueen")
            {
                ObjectivesManager.instance.DrawText("Find the portal.");
            }
            // death animation
            if (ragdoll != null)
            {
                GetComponent <CharacterAnimator>().isActive = false;
                ragdoll.Setup();
            }
            else
            {
                animator.SetTrigger("dead");
            }

            StartCoroutine(DestroyObject(30));

            enemyController.active = false;
            enemy.radius           = 0f;

            //loot
            LootManager lootManager = GetComponent <LootManager>();
            lootManager.DropLoot();
        }
    }
Пример #3
0
    // Use this for initialization
    void Awake()
    {
        #region Instance
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
        #endregion

        #region Set Code/Objects

        laser         = GetComponent <PlayerWeaponInventory>();
        loot          = GetComponent <LootManager>();
        frikinHealth  = GetComponent <PlayerHealthController>();
        scoringCode   = GetComponent <Parker_Scoring>();
        setAudio      = GetComponent <CS_SetAudioLevel>();
        respawnScript = GetComponent <RS_RespawnScript>();


        #endregion

        tickTimer = 0f;
    }
Пример #4
0
 private void Start()
 {
     for (int i = 0; i < 10; i++)
     {
         LootManager.GenerateWeapon(i + 70);;
     }
 }
Пример #5
0
 public void getLootManager()
 {
     if (lootManager == null)
     {
         lootManager = LootManager._instance;
     }
 }
Пример #6
0
    public static void GiveItem()
    {
        /*
         * PersistantGameManager.Instance.playerWeaponInventory[0] = new Weapon("Short Sword", 2f, 0.5f, 1, 1);
         * PersistantGameManager.Instance.playerWeaponInventory[1] = new Weapon("Dagger", 1f, 0.25f, 0.5f, 1);
         * PersistantGameManager.Instance.playerWeaponInventory[2] = new Weapon("Lance", 4f, 0.75f, 2, 1);
         */

        //PersistantGameManager.Instance.playerWeaponInventory[0] = LootManager.GenerateWeapon(10);
        //PersistantGameManager.Instance.playerWeaponInventory[1] = LootManager.GenerateWeapon(10);
        //PersistantGameManager.Instance.playerWeaponInventory[2] = LootManager.GenerateWeapon(10);

        //shortened to 3 items
        //PersistantGameManager.Instance.playerWeaponInventory[3] = new Weapon("Long Sword", 3f, 0.6f, 1.5f);
        //PersistantGameManager.Instance.playerWeaponInventory[4] = new Weapon("Axe", 10f, 2f, 1.5f);
        //PersistantGameManager.Instance.currentArmour = new Armour("Wooden", 0.5f);
        if (SceneManager.GetActiveScene().name == "Tutorial" || SceneManager.GetActiveScene().name == "Menu")
        {
            PersistantGameManager.Instance.playerWeaponInventory[0] = new Weapon("Empty", "", "", "", 0f, 0.00f, 0.00f, 0, 0);
            PersistantGameManager.Instance.playerWeaponInventory[1] = new Weapon("Empty", "", "", "", 0f, 0.00f, 0.00f, 0, 0);
            PersistantGameManager.Instance.playerWeaponInventory[2] = new Weapon("Empty", "", "", "", 0f, 0.00f, 0.00f, 0, 0);
        }
        else
        {
            PersistantGameManager.Instance.playerWeaponInventory[0] = LootManager.GenerateWeapon(100);
            PersistantGameManager.Instance.playerWeaponInventory[1] = LootManager.GenerateWeapon(10);
            PersistantGameManager.Instance.playerWeaponInventory[2] = LootManager.GenerateWeapon(10);
        }
    }
Пример #7
0
    public void StartLevel(QuestType q = null)
    {
        if (q != null)
        {
            objectiveEnum  = q.objectiveEnum;
            targetValue    = q.targetValue;
            totalEnemyCost = q.totalEnemyCost;
            waveAmount     = q.waveAmount;
            maxCost        = q.maxCost;
            minCost        = q.minCost;
        }

        if (lootManager == null)
        {
            lootManager = FindObjectOfType <LootManager>();
        }
        lootManager.generateLoot(Mathf.RoundToInt((targetValue + 1) * 2f));
        lootManager.spawnLoot();

        if (enemyManager == null)
        {
            enemyManager = FindObjectOfType <EnemyManager>();
        }
        enemyManager.setEnemyManager(totalEnemyCost, waveAmount, maxCost, minCost);
    }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        numOfUses = 1;
        myLoot    = GetComponent <LootManager>();
        switch (myType)
        {
        case ShopType.BasicShop:
            myLoot.pool = Constants.ItemPool.BasicShop;
            break;

        case ShopType.WeaponShop:
            myLoot.pool = Constants.ItemPool.WeaponShop;
            break;

        case ShopType.TrinketShop:
            myLoot.pool = Constants.ItemPool.TrinketShop;
            break;

        case ShopType.BlackMarket:
            myLoot.pool = Constants.ItemPool.BlackMarket;
            break;
        }
        //Debug.Log(myItem);
        myItem = GameManager.GetItemPools().GetItem(myLoot.pool);
        //Debug.Log(myItem);
    }
Пример #9
0
 protected override void Start()
 {
     base.Start();
     isClosed    = false;
     lootManager = GameObject.FindGameObjectWithTag("LootManager").GetComponent <LootManager>();
     loot        = lootManager.GenerateLoot("Box");
 }
Пример #10
0
    public virtual void Initialize(Entity owner) {
        this.owner = owner;

        lootManager = GetComponent<LootManager>();

        RegisterListeners();
    }
Пример #11
0
 private void Awake()
 {
     if (instance != null)
     {
         return;
     }
     instance = this;
 }
Пример #12
0
 // Use this for initialization
 void Start()
 {
     if (instance != null)
     {
         throw new Exception("2nd instance of lootmanager");
     }
     instance = this;
 }
Пример #13
0
 void OnDestroy()
 {
     _instance = this;
     if (_lootRoot != null)
     {
         Destroy(_lootRoot.gameObject);
     }
 }
Пример #14
0
    void Start()
    {
        gameOver    = false;
        testSpawner = GameObject.FindGameObjectWithTag("Respawn").GetComponentInParent <TestSpawner>();

        gameStateManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameStateManager>();
        lootManager      = GetComponent <LootManager> ();
    }
Пример #15
0
 void Start()
 {
     instance = this;
     potionPrefabs = new Dictionary<string, GameObject> ();
     weaponPrefabs = new Dictionary<string, GameObject> ();
     lootTables = new Dictionary<string, LootTable> ();
     _loadPrefabs();
     _loadLootTables ();
 }
Пример #16
0
 private void Awake()
 {
     _current = this;
     for (var i = 0; i < Items.Count; i++)
     {
         var item = Items[i].GetComponent<Weapon>();
         if (item != null)
             item.LootIndex = i;
     }
 }
Пример #17
0
    public void EndOfFight(bool won)
    {
        this.won = won;
        //GameObject.Find ("PlayerData").SetActive (false);
        //GameObject.Find ("EnemyData").SetActive (false);
        GameObject.Find("CrystalsBG").SetActive(false);
        GameObject.Find("TurnTag").SetActive(false);
        title.text        = won?"VICTORY!":"DEFEAT!";
        playerStatus      = GameObject.Find("Player").GetComponent <PlayerController>().getXP();
        XPSlider.maxValue = (float)100 * playerStatus [0];
        XPSlider.value    = (float)playerStatus [1];
        XPText.text       = playerStatus[1] + "/" + XPSlider.maxValue;
        if (won)
        {
            //Add loot
            if (EnemySelection.created && !EnemySelection.Instance.getDefeated())
            {
                EnemySelection.Instance.setDefeated(true);
                //loot and progress should only be saved if selected enemy was not yet defeated
                loot.SetActive(true);
                lm           = loot.GetComponent <LootManager> ();
                lm.items [0] = ItemPool [Random.Range(0, ItemPool.Length)].GetComponent <Item> ();
                lm.items [1] = ItemPool [Random.Range(0, ItemPool.Length)].GetComponent <Item> ();
                while (lm.items [0] == lm.items [1])
                {
                    lm.items [1] = ItemPool [Random.Range(0, ItemPool.Length)].GetComponent <Item> ();
                }
                lm.Initialize();
            }
            else
            {
                ContinueButton.interactable = true;
            }
            //Add experience points

            XPGained = (EnemySelection.created ? EnemySelection.Instance.experiencePoints : 5);
            if (playerStatus [1] + XPGained >= 100 * playerStatus [0])
            {
                levelUpText.text = "level up! " + playerStatus [0] + " -> " + (playerStatus [0] + 1) + "\n" +
                                   "Damage: " + Mathf.RoundToInt(100f * (float)Mathf.Pow(1.2f, playerStatus [0] - 1)) + "% ->" + Mathf.RoundToInt(100f * (float)Mathf.Pow(1.2f, playerStatus [0])) + "%\n" +
                                   "HP: " + Mathf.RoundToInt(300f * (float)Mathf.Pow(1.2f, playerStatus [0] - 1)) + "->" + Mathf.RoundToInt(300f * (float)Mathf.Pow(1.2f, playerStatus [0]));
            }
            else
            {
                levelUpText.text = "";
            }
            StartCoroutine(AnimateXPBar());
        }
        else
        {
            loot.SetActive(false);
            levelUpText.text            = "";
            ContinueButton.interactable = true;
        }
    }
Пример #18
0
        private void Awake()
        {
            var loot = LootManager.GetLootForMonster(MonsterManager.LastGeneratedMonster);

            GoldValue.text    = loot.Gold.ToString();
            PotionsValue.text = loot.SmallPotions.ToString();

            MainText.text = GetRandomQuote();

            LootManager.AddLootToBag(loot);
        }
Пример #19
0
    //Gives the reward for completing a quest
    public void GiveItem()
    {
        //Gives a weapon
        if (currentQuest.giveWeapon == true)
        {
            GameObject      questDrop        = Instantiate(Resources.Load("Loot Drop"), player.transform.position, Quaternion.identity) as GameObject;
            LootDropMonitor questDropMonitor = questDrop.GetComponent <LootDropMonitor>();

            questDropMonitor.type      = 0;
            questDropMonitor.itemStats = LootManager.GenerateSpecificWeapon(currentQuest.weaponType, currentQuest.weaponValue);
        }
        //Give an Item
        if (currentQuest.giveItem == true)
        {
            GameObject      questDrop        = Instantiate(Resources.Load("Loot Drop"), player.transform.position, Quaternion.identity) as GameObject;
            LootDropMonitor questDropMonitor = questDrop.GetComponent <LootDropMonitor>();

            questDropMonitor.type = 2;
            questDropMonitor.item = currentQuest.itemName;
        }
        //Gives Xp for quest
        PersistantGameManager.Instance.playerStats.playerExperience += currentQuest.questExperience;
        //Removes item from inventory
        if (!currentQuest.instantComplete && currentQuest.returnItem)
        {
            PersistantGameManager.Instance.itemInventory[currentQuest.questItemName]--;
        }
        //Tells PGM to move onto the next quest
        PersistantGameManager.Instance.characterQuests[nameOfNpc]++;

        //Removes quest from PGM
        PersistantGameManager.Instance.activeQuests.Remove(currentQuest.questKey);
        PersistantGameManager.Instance.possibleQuests.Remove(currentQuest.questKey);
        PersistantGameManager.Instance.completedQuests.Add(currentQuest.questKey);

        //Tells player they have completed the quest
        TextMeshProUGUI text = GameObject.FindGameObjectWithTag("Updates").GetComponent <TextMeshProUGUI>();

        if (!currentQuest.instantComplete)
        {
            text.text = "Completed " + currentQuest.questName;
        }

        hasTalkedBefore = false;
        currentQuest    = null;
        EndDialogue();

        //If instant complete then loop to next dialogue
        if (mGiveItem)
        {
            StartCoroutine(CreateDialogueBox());
            mGiveItem = false;
        }
    }
Пример #20
0
 void Awake()
 {
     if (Singleton != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Singleton = this;
     }
 }
Пример #21
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            LootManager myScript = (LootManager)target;

            if (GUILayout.Button("Load LootDatabase"))
            {
                myScript.LoadDatabase();
            }
        }
Пример #22
0
 void Awake()
 {
     if (get == null)
     {
         get = this;
     }
     else if (get != this)
     {
         Destroy(get);
     }
 }
Пример #23
0
    public void SetUp(ScoreManager scManager)
    {
        scoreManager = scManager;
        mainCamera   = GameManager.gameManager.MainCamera;

        SetUpStarsAndGoldPanel();
        SetUpLosePanel();
        SetUpLootingPanel();

        playerLootManager = GameManager.gameManager.Player.PlayerLootManager;
    }
Пример #24
0
 private void Awake()
 {
     if (lootManager == null)
     {
         lootManager = FindObjectOfType <LootManager>();
     }
     if (enemyManager == null)
     {
         enemyManager = FindObjectOfType <EnemyManager>();
     }
 }
Пример #25
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #26
0
 void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Пример #27
0
    void Awake()
    {
        spawner  = GetComponent <Spawner> ();
        myHealth = GetComponentInChildren <EnemyHealth> ();

        ChangeRanges(50f, 6f);
        //myHealth.maxHealth = 100;
        myHealth.isBoss          = true;
        myHealth.associatedScore = 1000;

        lootManager = GameObject.FindGameObjectWithTag("Lootable").GetComponent <LootManager> ();
    }
Пример #28
0
    // Use this for initialization
    void Start()
    {
        dragons         = new List <GameObject> ();
        patrolPositions = new List <Vector3> ();
        lootManager     = GameObject.FindGameObjectWithTag("Lootable").GetComponent <LootManager> ();
        spawner         = GetComponent <Spawner> ();

        InitPatrolPositions();
        spawnOne = false;

        SpawnMany(agentsPrefab[0]);
    }
Пример #29
0
    public void Start()
    {
        healthLeft  = health;
        rb          = gameObject.GetComponent <Rigidbody2D>();
        lootManager = GameObject.Find("GameManager").GetComponent <LootManager>();

        player    = GameObject.FindGameObjectWithTag("Player");
        playerPos = player.transform;
        animSpeed = gameObject.GetComponent <Animator>().speed;
        healthbar = GameObject.Find("Canvas").transform.GetChild(10).gameObject;
        healthbar.transform.position = new Vector3(-1000, -1000, 0);
    }
Пример #30
0
    //List<ItemBase>;

    // This is called before Start()
    private void Awake()
    {
        if (Instance == null)              // if instance doesn't contain anything, this script is running for the first time
        {
            Instance = this;               // set this curr instance to be contained inside ^ the static instance
            DontDestroyOnLoad(gameObject); // don't detroy the first instance
        }
        else
        {
            Destroy(gameObject); // destory other duplicated instances
        }
    }
Пример #31
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.transform.tag == "Loot")
        {
            Destroy(collision.gameObject);
            var loot = LootManager.GetLoot();

            //Somehow add this to my inventory and show it in the inventory UI in game
            AddToInventory(loot);

            Debug.Log("You found a " + loot.GetName() + "!");
        }
    }
Пример #32
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(transform.gameObject);
    }
Пример #33
0
	void Start () 
	{
		gameState = GameObject.FindObjectOfType<GameState>();
        loot = GameObject.FindObjectOfType<LootManager>();
	}