private void Awake() { if (instance == null) { instance = this; } }
//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(); } }
// 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; }
private void Start() { for (int i = 0; i < 10; i++) { LootManager.GenerateWeapon(i + 70);; } }
public void getLootManager() { if (lootManager == null) { lootManager = LootManager._instance; } }
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); } }
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); }
// 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); }
protected override void Start() { base.Start(); isClosed = false; lootManager = GameObject.FindGameObjectWithTag("LootManager").GetComponent <LootManager>(); loot = lootManager.GenerateLoot("Box"); }
public virtual void Initialize(Entity owner) { this.owner = owner; lootManager = GetComponent<LootManager>(); RegisterListeners(); }
private void Awake() { if (instance != null) { return; } instance = this; }
// Use this for initialization void Start() { if (instance != null) { throw new Exception("2nd instance of lootmanager"); } instance = this; }
void OnDestroy() { _instance = this; if (_lootRoot != null) { Destroy(_lootRoot.gameObject); } }
void Start() { gameOver = false; testSpawner = GameObject.FindGameObjectWithTag("Respawn").GetComponentInParent <TestSpawner>(); gameStateManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameStateManager>(); lootManager = GetComponent <LootManager> (); }
void Start() { instance = this; potionPrefabs = new Dictionary<string, GameObject> (); weaponPrefabs = new Dictionary<string, GameObject> (); lootTables = new Dictionary<string, LootTable> (); _loadPrefabs(); _loadLootTables (); }
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; } }
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; } }
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); }
//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; } }
void Awake() { if (Singleton != null) { Destroy(gameObject); } else { Singleton = this; } }
public override void OnInspectorGUI() { DrawDefaultInspector(); LootManager myScript = (LootManager)target; if (GUILayout.Button("Load LootDatabase")) { myScript.LoadDatabase(); } }
void Awake() { if (get == null) { get = this; } else if (get != this) { Destroy(get); } }
public void SetUp(ScoreManager scManager) { scoreManager = scManager; mainCamera = GameManager.gameManager.MainCamera; SetUpStarsAndGoldPanel(); SetUpLosePanel(); SetUpLootingPanel(); playerLootManager = GameManager.gameManager.Player.PlayerLootManager; }
private void Awake() { if (lootManager == null) { lootManager = FindObjectOfType <LootManager>(); } if (enemyManager == null) { enemyManager = FindObjectOfType <EnemyManager>(); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { if (!instance) { instance = this; } else { Destroy(this); } }
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> (); }
// 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]); }
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); }
//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 } }
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() + "!"); } }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(transform.gameObject); }
void Start () { gameState = GameObject.FindObjectOfType<GameState>(); loot = GameObject.FindObjectOfType<LootManager>(); }