34 lines
690 B
C#
34 lines
690 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITFALL.Entities.Equipment;
|
|
using BITKit;
|
|
using BITKit.Entities;
|
|
using TinyScript;
|
|
using UnityEngine;
|
|
|
|
namespace BITFALL.GameMode
|
|
{
|
|
public class BotRandomWeaponController : EntityBehavior
|
|
{
|
|
[SerializeField] private LootDrop lootDrop;
|
|
|
|
[Inject] private IHealth _health;
|
|
|
|
[Inject] private IEntityEquipment _equipment;
|
|
public override void OnStart()
|
|
{
|
|
base.OnStart();
|
|
_health.OnSetAlive += OnSetAlive;
|
|
}
|
|
|
|
private void OnSetAlive(bool obj)
|
|
{
|
|
if (obj is false) return;
|
|
var random = lootDrop.GetGuaranteeedLoot().Random().GetComponent<IBasicItem>();
|
|
|
|
_equipment.EntryEquip(random);
|
|
}
|
|
}
|
|
|
|
}
|