You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.0 KiB
C#
66 lines
2.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Assertions;
|
|
using SiegeSong;
|
|
|
|
namespace SiegeSong
|
|
{
|
|
public class ApparrelManager : MonoBehaviour
|
|
{
|
|
//public string UndershirtKey;
|
|
public string UnderpantsKey;
|
|
public GameObject Wardrobe;
|
|
public int[] CurrentlyActiveIDs;
|
|
public InventoryManager InventoryManager;
|
|
|
|
void Start()
|
|
{
|
|
UpdateApparrel();
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void UpdateApparrel()
|
|
{
|
|
var pantless = true;
|
|
//var shirtless = true;
|
|
|
|
for (var i = 0; i < Wardrobe.transform.childCount; i++)
|
|
Wardrobe.transform.GetChild(i).gameObject.active = false;
|
|
|
|
foreach (var activeID in CurrentlyActiveIDs)
|
|
{
|
|
var inventoryObject = InventoryManager.GetItemByID(activeID);
|
|
if (inventoryObject != null && inventoryObject.GetComponent<InventoryItem>())
|
|
{
|
|
var inventoryItem = inventoryObject.GetComponent<InventoryItem>();
|
|
var wearable = Wardrobe.transform.Find(inventoryItem.WardrobeKey);
|
|
|
|
wearable.gameObject.active = true;
|
|
|
|
if (inventoryItem.AparrelSlot == AparrelSlot.Belt)
|
|
pantless = false;
|
|
|
|
//if (inventoryItem.AparrelSlot == AparrelSlot.Chest)
|
|
// shirtless = false;
|
|
}
|
|
|
|
if (pantless && UnderpantsKey.Length > 0)
|
|
Wardrobe.transform.Find(UnderpantsKey).gameObject.active = true;
|
|
else
|
|
Wardrobe.transform.Find(UnderpantsKey).gameObject.active = false;
|
|
|
|
//if (shirtless && UndershirtKey.Length > 0)
|
|
// Wardrobe.transform.Find(UndershirtKey).gameObject.active = true;
|
|
//else
|
|
// Wardrobe.transform.Find(UndershirtKey).gameObject.active = false;
|
|
}
|
|
}
|
|
|
|
}
|
|
} |