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.

43 lines
1.5 KiB
C#

3 weeks ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TWS_PreviewCharacterHandler : TWS_CustomizableCharacter
{
// Start is called before the first frame update
void OnEnable()
{
TWS_Delegates._OnLookRotationHappenedFromJoystick = RotatePreviewCharacterInDirection;
TWS_Delegates._OnCustomizationCatagoryChangedFromUI = OnCharacterCustomizationCatagoryChanged;
TWS_Delegates._OnItemCustomizationSelected = ApplyItemCustomization;
ApplyAllCustomizationsFromCustomizationData();
}
void OnCharacterCustomizationCatagoryChanged(string currentSelectedCatagoryName)
{
customizationAppliers.ForEach(x=> {
x.gameObject.SetActive(false);
});
TWS_ItemCustomizationApplier currentSelectedCatagory = customizationAppliers.Find(x => x.catagoryName.Equals(currentSelectedCatagoryName));
currentSelectedCatagory.gameObject.SetActive(true);
}
void RotatePreviewCharacterInDirection(int direction)
{
transform.Rotate(Vector2.up * direction);
}
public List<TWS_AppliedCustomizationsData> GetAllAppliedCustomizations()
{
List<TWS_AppliedCustomizationsData> currentAppliedCustomizations = new List<TWS_AppliedCustomizationsData>();
customizationAppliers.ForEach(x =>
{
currentAppliedCustomizations.AddRange(x.GetAppliedCustomizationData());
});
return currentAppliedCustomizations;
}
}