summaryrefslogtreecommitdiff
path: root/GameCode/CharacterCreator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GameCode/CharacterCreator.cs')
-rw-r--r--GameCode/CharacterCreator.cs101
1 files changed, 101 insertions, 0 deletions
diff --git a/GameCode/CharacterCreator.cs b/GameCode/CharacterCreator.cs
new file mode 100644
index 0000000..55d31ed
--- /dev/null
+++ b/GameCode/CharacterCreator.cs
@@ -0,0 +1,101 @@
+using System;
+using UnityEngine;
+
+public class CharacterCreator : MonoBehaviour
+{
+ public PlayerFace currentPlayerFace;
+
+ public GameObject objectToEnable;
+
+ public int playerID;
+
+ public int portraitID;
+
+ public bool ready;
+
+ public PlayerActions playerActions;
+
+ public GeneralInput.InputType inputType;
+
+ public MenuControllerHandler.MenuControl currentControl = MenuControllerHandler.MenuControl.Unassigned;
+
+ public MenuControllerHandler.MenuControl lastControl = MenuControllerHandler.MenuControl.Unassigned;
+
+ public Action<MenuControllerHandler.MenuControl> SwitchAction;
+
+ public CharacterCreatorNavigation nav;
+
+ private void Start()
+ {
+ nav = GetComponentInChildren<CharacterCreatorNavigation>();
+ }
+
+ private void Update()
+ {
+ if (currentControl != lastControl)
+ {
+ SwitchAction?.Invoke(currentControl);
+ }
+ lastControl = currentControl;
+ }
+
+ public void Close()
+ {
+ CharacterCreatorHandler.instance.ReleasePortrait(portraitID);
+ if (playerActions == null)
+ {
+ base.gameObject.SetActive(value: false);
+ MainMenuHandler.instance.Open();
+ }
+ else
+ {
+ objectToEnable.SetActive(value: true);
+ base.gameObject.SetActive(value: false);
+ }
+ }
+
+ public void Finish()
+ {
+ CharacterCreatorHandler.instance.ReleasePortrait(portraitID);
+ CharacterCreatorHandler.instance.SetFacePreset(portraitID, currentPlayerFace);
+ CharacterCreatorHandler.instance.SelectFace(0, currentPlayerFace, portraitID);
+ if (playerActions == null)
+ {
+ base.gameObject.SetActive(value: false);
+ MainMenuHandler.instance.Open();
+ }
+ else
+ {
+ objectToEnable.SetActive(value: true);
+ base.gameObject.SetActive(value: false);
+ }
+ }
+
+ internal void SetOffset(Vector2 offset, CharacterItemType itemType, int slotID)
+ {
+ if (itemType == CharacterItemType.Eyes)
+ {
+ currentPlayerFace.eyeOffset = offset;
+ }
+ if (itemType == CharacterItemType.Mouth)
+ {
+ currentPlayerFace.mouthOffset = offset;
+ }
+ if (itemType == CharacterItemType.Detail)
+ {
+ if (slotID == 0)
+ {
+ currentPlayerFace.detailOffset = offset;
+ }
+ if (slotID == 1)
+ {
+ currentPlayerFace.detail2Offset = offset;
+ }
+ }
+ }
+
+ internal void SpawnFace(PlayerFace currentFace)
+ {
+ GetComponentInChildren<CharacterCreatorItemEquipper>().SpawnPlayerFace(currentFace);
+ }
+}