Exemplo n.º 1
0
    //private void OnTriggerEnter2D(Collider2D otherCollider) {
    //    OverworldNPCController lootableShip = otherCollider.GetComponent<OverworldNPCController>();
    //    if(lootableShip && lootableShip.IsLootable() && otherCollider is CapsuleCollider2D) {
    //        looting = true;
    //    }
    //}
    private void OnTriggerStay2D(Collider2D otherCollider)
    {
        OverworldNPCController lootableShip = otherCollider.GetComponent <OverworldNPCController>();

        if (lootableShip && lootableShip.IsLootable() && otherCollider is CapsuleCollider2D)
        {
            looting = true;
        }
        //LootCountdown();
        if (lootTimer <= 0 && otherCollider is CapsuleCollider2D)
        {
            /*shipInventory.GiveItem(lootableShip.GetLoot().id, lootableShip.GetLootQuantity());*/
            lootableShip.GiveLoot();
            lootableShip.Kill();
            ResetLootTimer();
            looting = false;
        }
    }
Exemplo n.º 2
0
 private void Awake()
 {
     controller = GetComponent <OverworldNPCController>();
 }