public static LootPool GenerateMasterLootPool() { if (!loaded) { Debug.LogError("Made lootpool when lootpool wasn't loaded!"); } LootPool master = new LootPool(); foreach (KeyValuePair <int, GearData> pair in allGear) { GearData gear = pair.Value; if (gear.rarity != LootPool.LootRarity.DontSpawn) { //only one of each can be equipped at a time, so the lootpool only needs one copy if (gear.requiredSlot == GearSlotTypes.Head || gear.requiredSlot == GearSlotTypes.Body || gear.requiredSlot == GearSlotTypes.Core) { master.AddGear(gear); } else { master.AddGear(gear, n: 2); } } } return(master); }
public LootPool Clone() { LootPool newpool = new LootPool(); newpool.pool.AddRange(pool); newpool.quantities = new Dictionary <GearData, int>(quantities); return(newpool); }
void Start() { bulletPool = transform.FindChild("Bullets").GetComponent <BulletPool>(); enemyPool = transform.FindChild("Enemies").GetComponent <EnemyPool>(); greenPool = transform.FindChild("Greens").GetComponent <GreenPool>(); lootPool = transform.FindChild("Loot").GetComponent <LootPool>(); objectSpawner = GetComponent <ObjectSpawner>(); generateMap(MapType.rockyForest); }
// Update is called once per frame void Update() { if (lootPool == null) { lootPool = new SkeletonLootPool(); // <---------------------------------------------------------------- not good! } //Debug.Log (!specialAttack ()); if (!isDead) { checkRadiusForOpponents(); handleAggro(); checkIfUnderAttack(false); if (!gettingHit) { if (hasOpponent()) { if (!opponent.GetComponent <Creature> ().isDead&& !specialAttack() && npcInChasingTime()) { chase(); } else if (Vector3.Distance(transform.position, opponent.transform.position) > 2) { lastChaseTime = Time.time; } } else { live(); } } resetGettingHit(); } else { if (!isCorpse) { dieAndBecomeCorpse(); } } }
protected void Init() { myPosition = gameObject.transform; circleCollider = gameObject.GetComponent <CircleCollider2D>(); rb2D = gameObject.GetComponent <Rigidbody2D>(); inputDelay = new InputDelay(); combatActive = GameState.combatState; if (GameState.GameMovementStopped()) { movementStopped = true; } destinationSetter = gameObject.GetComponent <AIDestinationSetter>(); aIPath = gameObject.GetComponent <AIPath>(); meleeAttack = gameObject.GetComponentInChildren <MeleeAttackSprite>(); audioSource = gameObject.GetComponent <AudioSource>(); sprite = gameObject.GetComponent <SpriteRenderer>(); dyingBreath = gameObject.GetComponent <DyingBreath>(); loot = gameObject.GetComponent <LootPool>(); SetHealth(); SetCombat(); SetVision(); SetAI(); }