Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 public void Show(Vector2 pos, ItemData i, LootFactory lf)
 {
     factory = lf;
     gameObject.SetActive(true);
     data = i;
     gameObject.transform.position = pos;
     gameObject.GetComponent <SpriteRenderer>().sprite = i.sprite;
 }
Ejemplo n.º 2
0
	// Use this for initialization
	void Start () {
		opened = false;
		findEnabledPlayer();
		lootFactory = GameObject.FindObjectOfType<LootFactory> ();
		animator = GetComponent<Animator> ();
		openedAnimator = "opened";
		itemDropMethod = "delayedItemDrop";
		itemDropDelay = 1.5f;
	}
Ejemplo n.º 3
0
    public void Drop()
    {
        int rand = Random.Range(0, 4);

        loot = LootFactory.GetAssortedRandomLoot(dropRate, this, new GameObject());
        if (rand > 0)
        {
            Instantiate(altDrop, transform.position, Quaternion.identity);
        }
    }
Ejemplo n.º 4
0
 private void Start()
 {
     Instance = this;
     for (int i = 0; i < MaxNumberOfLoot; i++)
     {
         GameObject obj = Instantiate(lootPrefab, gameObject.transform);
         LootScript ls  = obj.GetComponent <LootScript>();
         ls.Hide();
         l_Pool.Add(ls);
     }
 }
Ejemplo n.º 5
0
 public Room(int aNumberOfEnemies, int anAmountOfItems, bool isBossRoom, Player.Player aPlayer)
 {
     myDoors           = new List <Doors>();
     myEnemies         = new List <Enemy>();
     myLoot            = new List <Item>();
     myChests          = new List <Loot.Chest>();
     myNumberOfEnemies = aNumberOfEnemies;
     myIsBossRoom      = isBossRoom;
     myEnemies         = Factories.EnemyFactory.CreateEnemies(myNumberOfEnemies, Utility.GetRNG().Next(1, aPlayer.GetLevel() + 1));
     if (Utilities.Utility.GetRNG().Next(0, 100) < aPlayer.GetLuck())
     {
         myChestCount = Utilities.Utility.GetRNG().Next(0, 3);
         for (int i = 0; i < myChestCount; i++)
         {
             myChests.Add(LootFactory.CreateChest());
         }
     }
     for (int i = 0; i < anAmountOfItems; i++)
     {
         myLoot.Add(Factories.LootFactory.CreateItem());
     }
     if (!myIsBossRoom)
     {
         if (aNumberOfEnemies > 0)
         {
             myAreHostilesPresent = true;
             myGold        = Utilities.Utility.GetRNG().Next(5, 20 * (aNumberOfEnemies) + 1);
             myHPPotions   = Utilities.Utility.GetRNG().Next(0, (aNumberOfEnemies) / 2 + 1);
             myManaPotions = Utilities.Utility.GetRNG().Next(0, (aNumberOfEnemies) / 2 + 1);
         }
         else
         {
             myAreHostilesPresent = false;
         }
     }
     else
     {
         myAreHostilesPresent = true;
         myBoss = Factories.EnemyFactory.CreateBoss(aPlayer.GetLevel());
     }
 }
        public void GetLoot_When_Called_Returns_A_Singular_Item_Decription_Of_Loot(string expected, int index)
        {
            LootCollection fakeLootCollection = new LootCollection();

            var LootList = new List <LootModel>();

            LootList.Add(new LootModel("A Shiny Thing", 10));
            LootList.Add(new LootModel("Money", 100));
            LootList.Add(new LootModel("Rusted shield", 1));
            fakeLootCollection.Loot = LootList;

            var mockRepository = new Mock <IRepository>();

            mockRepository
            .Setup(x => x.GetLootCollection())
            .Returns(fakeLootCollection);

            var sut    = new LootFactory(mockRepository.Object);
            var result = sut.GetLoot(index);

            Assert.Equal(expected, result.Description);
        }
Ejemplo n.º 7
0
 public IEnumerator Cooldown()
 {
     coolingDown = true;
     while (incrementer > 0)
     {
         incrementer = 0;
         yield return(new WaitForSeconds(cooldown));
     }
     if (count > 1)
     {
         GameObject player           = GameObject.FindGameObjectWithTag("Player");
         Vector3    intendedLocation = new Vector3(player.transform.position.x, player.transform.position.y + 4f, player.transform.position.z);
         GameObject note             = Instantiate(comboMesh, intendedLocation, Quaternion.identity);
         note.GetComponent <TextMesh>().text = count.ToString() + "x COMBO";
         note.transform.parent = player.transform;
         int rand = Random.Range(0, 4);
         LootFactory.GetAssortedRandomLoot(count, this, note.gameObject);
         StartCoroutine("PushUp", note);
     }
     coolingDown = false;
     count       = 0;
 }
Ejemplo n.º 8
0
	protected void enemyStart(){
		
		characterStart ();
		sphere.renderer.material.color = Color.red;
		grid = (Grid)GameObject.FindObjectOfType (typeof(Grid));
		pathing = (PathFinding)GameObject.FindObjectOfType (typeof(PathFinding));
		experienceBase = 25;
		xpGiven = false;
		lootGiven = false;
		lootFactory = GameObject.FindObjectOfType<LootFactory> ();
		
		// networking: makes sure each enemy is properly instantiated even on another game instance that didn't run the EnemyFactory code.
		target = (Fighter) GameObject.FindObjectOfType (typeof (Fighter)); // for the enemies perspective target is always fighter
		sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer (); // sorcerer = (Sorcerer) GameObject.FindObjectOfType (typeof (Sorcerer));

		
		level = target.level;
		initializePrimaryStats();
		initializeSecondaryStatsBase();
		initializeSecondaryStats();
		calculateSecondaryStats();
		health = maxHealth;
		energy = maxEnergy;
		
		activeSkill1 = (BasicMelee)GetComponent<BasicMelee>();

		
		this.transform.parent = GameObject.Find("Enemies").transform;

		// networking:
		enemyNetworkScript = (EnemyNetworkScript)GetComponent<EnemyNetworkScript> ();
		
		collider = GetComponent<CapsuleCollider>();
		wanderScript = GetComponent<Wander> ();
		arriveScript = GetComponent<Arrive> ();
	}
Ejemplo n.º 9
0
 public void Drop()
 {
     loot = LootFactory.GetAssortedRandomLoot(Random.Range(dropRate - 5, dropRate), this, new GameObject());
 }