public void OnDeath(PlayerUnitController unit, Vector2 relictVelocity)
    {
        PlayerBaseStats stats         = unit.di.stats;
        SlimeType       poofType      = stats.SlimeType;
        Vector2         spawnPosition = unit.transform.position;

        SlimePoof slimePoof = poofs[poofType];

        slimePoof.SpawnAt(spawnPosition);

        foreach (SlimeType type in SlimeTypeHelpers.GetEnumerable())
        {
            if (stats.HasType(type))
            {
                SlimeRelict relict = relicts[type];
                relict.SpawnAt(spawnPosition);

                Vector2 velocity = GenerateRelictVelocity();

                relict.SetVelocity(velocity);
                relict.SetRotation(RandomHelpers.Range(relicRotationsPerSecond));
                //relictVelocity = Vector2.zero;
            }
        }
    }
 public override void Inject(PlayerUnitDI di)
 {
     strength = 0;
     hearts   = 0;
     foreach (SlimeType type in SlimeTypeHelpers.GetEnumerable())
     {
         AddStatsFrom(type);
     }
 }
Exemple #3
0
 private bool HasMergedAny(PlayerBaseStats stats)
 {
     foreach (SlimeType type in SlimeTypeHelpers.GetEnumerable())
     {
         if (canInteract.Get(type) && stats.HasType(type))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #4
0
    public void Inject(PlayerController controller)
    {
        this.controller    = controller;
        assemblySelectable = controller.di.assemblySelectable;

        selectables = new SlimeMap <PlayerUnitSelectable>();
        foreach (SlimeType slimeType in SlimeTypeHelpers.GetEnumerable())
        {
            selectables[slimeType] = (PlayerUnitSelectable)controller.di.units[slimeType].di.selectable;
        }
    }
Exemple #5
0
 private void RecalculateState()
 {
     strength        = 0;
     hearts          = 0;
     isFullAssembly  = true;
     isEmptyAssembly = true;
     foreach (SlimeType type in SlimeTypeHelpers.GetEnumerable())
     {
         if (mergedSlimes.Get(type))
         {
             AddStatsFrom(type);
             if (!type.IsKing())
             {
                 isEmptyAssembly = false;
             }
         }
         else
         {
             isFullAssembly = false;
         }
     }
     OnChange(this);
 }
    private void OnSelectChange(SlimeType selectedType)
    {
        SlimeTypeUI newSelectedSlimeUI = slimeTypesUI[selectedType];

        crownUI.transform.SetParent(newSelectedSlimeUI.transform, worldPositionStays: false);
        if (selectedSlimeUI)
        {
            selectedSlimeUI.Deselect();
        }
        selectedSlimeUI = newSelectedSlimeUI;
        selectedSlimeUI.Select();

        foreach (SlimeType slimeType in SlimeTypeHelpers.GetEnumerable())
        {
            if (unitHandler.GetSelectable(slimeType).IsUnlocked)
            {
                slimeTypesUI[slimeType].Show();
            }
            else
            {
                slimeTypesUI[slimeType].Hide();
            }
        }
    }