private void Spawn()
    {
        Wave wave = waves [Mathf.Min(currentSpawner, waves.Length - 1)];

        enemySpawner.Spawn(wave.amountByEnemy);
        itemSpawner.Spawn(wave.itens);
    }
    public void StartSpawners()
    {
        foreach (Transform child in transform)
        {
            ItemSpawner itemSpawner = child.GetComponent <ItemSpawner>();
            if (itemSpawner != null && (difficulty == 1 || difficulty == 2))
            {
                itemSpawner.Spawn(0, 1);
            }
            EnemySpawner spawner = child.GetComponent <EnemySpawner>();
            if (spawner != null)
            {
                switch (difficulty)
                {
                case 1:
                    spawner.Spawn(0, 1);
                    break;

                case 2:
                    spawner.Spawn(1, 2);
                    break;

                case 3:
                    spawner.Spawn(2, 3);
                    break;

                default:
                    break;
                }
            }
        }
    }
Beispiel #3
0
 void SpawnItems()
 {
     itemSpawner = GetComponent <ItemSpawner>();
     if (itemSpawner != null)
     {
         itemSpawner.Spawn();
     }
 }
Beispiel #4
0
 public IEnumerator Run()
 {
     snakes = snakeSpawner.Snakes;
     while (snakes.Count > 1)
     {
         itemSpawner.Spawn();
         NextSnakesMove();
         yield return(new WaitForSeconds(delayBeforeMove * delayCoef));
     }
     ui.AddWinnerRecord(snakes?[0]);
     StopAllCoroutines();
 }
Beispiel #5
0
    public void Die()
    {
        foreach (Item item in drops)
        {
            if (Random.value > 0.4f)
            {
                itemSpawner.Spawn(item, transform.position);
            }
        }

        Destroy(gameObject);
    }
 protected void SetDead()
 {
     state          = State.Dead;
     health         = 0;
     renderer.color = deadColor;
     foreach (var c in bodyWeaponColliders)
     {
         c.enabled = false;
     }
     StartCoroutine(DeathRoutine(.5f));
     animator.SetBool("Dead", true);
     itemSpawner.Spawn();
 }
Beispiel #7
0
    IEnumerator Respawner()
    {
        while (true)
        {
            float distance = Vector3.Distance(playerTransform.position, transform.position);
            if (distance < 30 && distance > 20)
            {
                itemSpawner.Spawn(item, transform.position);
            }

            yield return(new WaitForSeconds(5));
        }
    }
Beispiel #8
0
    public void Equip(Unit unit)
    {
        if (isEquipped)
        {
            return;
        }

        slotComponent = ItemSpawner.Spawn(unit.gameObject, data, primarySlot);

        foreach (PerkID perkId in data.Perks)
        {
            unit.AddPerk(Main.StaticData.Game.Perks.GetValue(perkId));
        }

        isEquipped = true;
        ownerUnit  = unit;
    }
Beispiel #9
0
    public static GameObject GetModel(UnitData unitData, bool withItems = true, bool withUiAnimationController = false)
    {
        var result = Object.Instantiate(Main.StaticData.Game.Races.GetValue(unitData.RaceName).Graphics.ModelObject);

        if (withItems)
        {
            foreach (var itemInfo in unitData.Inventory.EquipmentData.GetEquippedItems())
            {
                ItemSpawner.Spawn(result, itemInfo.Item, itemInfo.PrimarySlot);
            }
        }
        if (withUiAnimationController)
        {
            AddUiAnimationController(result, unitData);
        }

        return(result);
    }
    public Stage Generate()
    {
        Cell[,] cells = cellGenerator.Generate(stageSize);

        Room[]           rooms           = roomGenerator.Generate(cells);
        RoomConnection[] roomConnections = roomConnector.ConnectRooms(cells, rooms);

        WallController wallController = wallConstructor.Construct(rooms, stageSize, roomConnections);
        Navigator      navigator      = new Navigator(cells);

        Stage stage = new Stage(stageSize, cells, rooms, navigator, fogOfWarController);

        cellDecorator.Decorate(stage);
        wallDecorator.Decorate(cells, wallController);
        fogOfWarController.ConcealStage(stage);
        fogOfWarController.Initialize();

        creatureSpawner.Spawn(stage);
        itemSpawner.Spawn(stage, itemController);

        return(stage);
    }
Beispiel #11
0
 protected void SetDead(bool dropItemDirRight, Type type, float colliderDisableDelay = 0.5f)
 {
     state          = State.Dead;
     health         = 0;
     renderer.color = deadColor;
     foreach (var c in bodyWeaponColliders)
     {
         c.enabled = false;
     }
     rb.gravityScale = 1;
     StartCoroutine(DeathRoutine(colliderDisableDelay));
     animator.SetBool("Dead", true);
     itemSpawner.Spawn(dropItemDirRight, type);
     if (plr.equipment.slots[8].itemas != null && plr.equipment.slots[8].itemas.currentUses < plr.equipment.slots[8].itemas.maxUses)
     {
         plr.equipment.slots[8].itemas.currentUses++;
         plr.UpdatePotionSprite(plr.equipment.slots[8].itemas);
         plr.statusGUI.UpdatePotionCharges();
     }
     if (isSummon)
     {
         summonDiedAction.Invoke();
     }
 }