Archival Commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using UnityEngine;
|
||||
|
||||
public class AnimatorMaster : MonoBehaviour
|
||||
{
|
||||
|
||||
public Animator taskListAnim;
|
||||
private bool isTaskListOpened = false;
|
||||
|
||||
public void TaskMenuButton()
|
||||
{
|
||||
if (isTaskListOpened)
|
||||
{
|
||||
isTaskListOpened = false;
|
||||
taskListAnim.SetBool("IsOpen", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
isTaskListOpened = true;
|
||||
taskListAnim.SetBool("IsOpen", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2b094aaa30d7b95499dbb08901092555
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class DayScreen : MonoBehaviour
|
||||
{
|
||||
|
||||
public TMP_Text text;
|
||||
|
||||
private Animator anim;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void changeDay(string newText)
|
||||
{
|
||||
anim.SetTrigger("Animate");
|
||||
|
||||
text.text = newText;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d23f4c2e657fabf47ace961f4d616af6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,132 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class DialogueManager : MonoBehaviour
|
||||
{
|
||||
|
||||
public Dialogue activeDialog;
|
||||
|
||||
public DialogueUI DialogUI_Left;
|
||||
public DialogueUI DialogUI_Right;
|
||||
|
||||
|
||||
private int index = 0;
|
||||
|
||||
|
||||
private bool working = false;
|
||||
|
||||
|
||||
|
||||
/*private void Start()
|
||||
{
|
||||
|
||||
//DialogUI_Left.Speaker = activeDialog.leftChar;
|
||||
//DialogUI_Right.Speaker = activeDialog.rightChar;
|
||||
|
||||
//DialogUI_Left.Hide();
|
||||
//DialogUI_Right.Hide();
|
||||
|
||||
//gameObject.SetActive(false);
|
||||
|
||||
}*/
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!working)
|
||||
{
|
||||
if(Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0))
|
||||
{
|
||||
StopAllCoroutines();
|
||||
ContinueDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StartDialog(Dialogue newDialogue)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
activeDialog = newDialogue;
|
||||
|
||||
DialogUI_Left.Speaker = activeDialog.leftChar;
|
||||
DialogUI_Right.Speaker = activeDialog.rightChar;
|
||||
|
||||
|
||||
index = 0;
|
||||
ContinueDialog();
|
||||
}
|
||||
|
||||
|
||||
private void ContinueDialog()
|
||||
{
|
||||
working = true;
|
||||
if(index < activeDialog.textLines.Length)
|
||||
{
|
||||
NextLine();
|
||||
index += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
FinishDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void NextLine()
|
||||
{
|
||||
TextLine line = activeDialog.textLines[index];
|
||||
Character character = line.activeChar;
|
||||
|
||||
if (DialogUI_Left.SpeakerIs(character))
|
||||
{
|
||||
SetDialog(DialogUI_Left, DialogUI_Right, line);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetDialog(DialogUI_Right, DialogUI_Left, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetDialog(DialogueUI activeUI, DialogueUI inactiveUI, TextLine line)
|
||||
{
|
||||
inactiveUI.Hide();
|
||||
activeUI.Show();
|
||||
|
||||
activeUI.portrait.sprite = line.activeChar.emociones[(int)line.emotion];
|
||||
|
||||
working = false;
|
||||
|
||||
StartCoroutine(TypeAnim(activeUI, line.sentence));
|
||||
}
|
||||
|
||||
|
||||
private void FinishDialog()
|
||||
{
|
||||
DialogUI_Left.Hide();
|
||||
DialogUI_Right.Hide();
|
||||
gameObject.SetActive(false);
|
||||
|
||||
GameObject.FindGameObjectWithTag("SD").GetComponent<SceneDirector>().FinishEvent();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IEnumerator TypeAnim(DialogueUI UI, string sentence)
|
||||
{
|
||||
UI.dialogueText.text = "";
|
||||
foreach (char letter in sentence)
|
||||
{
|
||||
UI.dialogueText.text += letter;
|
||||
yield return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea919a9e2bd2c854b807be692645fe0e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,58 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class DialogueUI : MonoBehaviour
|
||||
{
|
||||
|
||||
public Image portrait;
|
||||
|
||||
public TMP_Text nameText;
|
||||
public TMP_Text dialogueText;
|
||||
|
||||
|
||||
private Character speaker;
|
||||
public Character Speaker
|
||||
{
|
||||
get { return speaker; }
|
||||
set {
|
||||
|
||||
speaker = value;
|
||||
portrait.sprite = speaker.emociones[(int)charFeelings.Normal];
|
||||
nameText.text = speaker.fullName;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasSpeaker()
|
||||
{
|
||||
return speaker != null;
|
||||
}
|
||||
|
||||
public bool SpeakerIs(Character character)
|
||||
{
|
||||
return speaker == character;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string Dialog
|
||||
{
|
||||
set { dialogueText.text = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
public void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d91f28e07b37a347bd7b0e648a7f724
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ElectionsManager : MonoBehaviour
|
||||
{
|
||||
|
||||
public ElectionsUI electionsUI;
|
||||
|
||||
|
||||
|
||||
public void StartElection()
|
||||
{
|
||||
electionsUI.Show();
|
||||
}
|
||||
|
||||
|
||||
public void MakeElection(ElectionOptions selectedOption)
|
||||
{
|
||||
electionsUI.Hide();
|
||||
GameObject.FindGameObjectWithTag("SD").GetComponent<SceneDirector>().FinishEvent();
|
||||
}
|
||||
|
||||
public void ElectionPress(int i)
|
||||
{
|
||||
MakeElection((ElectionOptions)i);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public enum ElectionOptions
|
||||
{
|
||||
option1 = 1, option2, option3
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86bb15886332f714eafbc8be55348063
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ElectionsUI : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject mainUI;
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
mainUI.SetActive(false);
|
||||
}
|
||||
public void Show()
|
||||
{
|
||||
mainUI.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ff974bec1abc1948b63092cfcdb7427
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c704eaddafbdf3c4aa54cad2781d3df9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public struct ObjectItaretion
|
||||
{
|
||||
public GameObject obj;
|
||||
public bool completed;
|
||||
}
|
||||
|
||||
|
||||
public class Minigame : MonoBehaviour
|
||||
{
|
||||
public ObjectItaretion[] objectsToInterat;
|
||||
public Task taskToComplete;
|
||||
|
||||
private TaskManager TM;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
TM = GameObject.FindGameObjectWithTag("TM").GetComponent<TaskManager>();
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
foreach (ObjectItaretion objectIt in objectsToInterat)
|
||||
{
|
||||
|
||||
if (!objectIt.completed)
|
||||
{
|
||||
objectIt.obj.GetComponent<ObjectAnim>().interatuable = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ObjectInteraction(GameObject interactedObj)
|
||||
{
|
||||
for(int i = 0; i < objectsToInterat.Length; i++)
|
||||
{
|
||||
if(objectsToInterat[i].obj == interactedObj && !objectsToInterat[i].completed)
|
||||
{
|
||||
|
||||
objectsToInterat[i].completed = true;
|
||||
interactedObj.GetComponent<ObjectAnim>().interatuable = false;
|
||||
interactedObj.GetComponent<ObjectAnim>().ResetScale();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = objectsToInterat.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (!objectsToInterat[i].completed)
|
||||
{
|
||||
break;
|
||||
}
|
||||
FinishMinigame();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void FinishMinigame()
|
||||
{
|
||||
gameObject.GetComponentInParent<WindowAnimation>().CloseWindow();
|
||||
TM.CompleteTask(taskToComplete);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ad9f9346bd456b459b88444b25db631
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(BoxCollider2D))]
|
||||
public class MinigameStarter : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject miniGamePrefab;
|
||||
|
||||
public bool interatuable = false;
|
||||
|
||||
public Vector3 scaleAmount;
|
||||
|
||||
private Collider2D col;
|
||||
private Vector3 startScale;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
col = GetComponent<Collider2D>();
|
||||
startScale = transform.localScale;
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (interatuable)
|
||||
{
|
||||
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Vector2 mousePos2D = new Vector2(mousePos.x, mousePos.y);
|
||||
|
||||
RaycastHit2D hit = Physics2D.Raycast(mousePos2D, Vector2.zero);
|
||||
|
||||
if (hit.collider == col)
|
||||
{
|
||||
transform.localScale = startScale + scaleAmount;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
OnInteract();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.localScale = startScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void OnInteract()
|
||||
{
|
||||
Instantiate(miniGamePrefab);
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
|
||||
public void ResetScale()
|
||||
{
|
||||
transform.localScale = startScale;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c447ee4c824be949b33557be484e088
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[RequireComponent(typeof(BoxCollider2D))]
|
||||
public class ObjectAnim : MonoBehaviour
|
||||
{
|
||||
|
||||
//public objectAnimType objType;
|
||||
|
||||
public bool interatuable = false;
|
||||
|
||||
public Vector3 scaleAmount;
|
||||
|
||||
private Collider2D col;
|
||||
private Vector3 startScale;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
col = GetComponent<Collider2D>();
|
||||
startScale = transform.localScale;
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (interatuable)
|
||||
{
|
||||
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
Vector2 mousePos2D = new Vector2(mousePos.x, mousePos.y);
|
||||
|
||||
RaycastHit2D hit = Physics2D.Raycast(mousePos2D, Vector2.zero);
|
||||
|
||||
if(hit.collider == col)
|
||||
{
|
||||
transform.localScale = startScale + scaleAmount;
|
||||
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
gameObject.GetComponentInParent<Minigame>().ObjectInteraction(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.localScale = startScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ResetScale()
|
||||
{
|
||||
transform.localScale = startScale;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public enum objectAnimType
|
||||
{
|
||||
minigame = 0, scene = 1
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64d33ee7ca4e8e145bc63c7096606e38
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,104 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Timers;
|
||||
using UnityEngine;
|
||||
|
||||
public class WindowAnimation : MonoBehaviour
|
||||
{
|
||||
|
||||
WindowAnimation(Vector2 givenStartPos, Vector2 givenTarget)
|
||||
{
|
||||
startPos = givenStartPos;
|
||||
targetPos = givenTarget;
|
||||
}
|
||||
|
||||
public Vector2 startPos;
|
||||
public Vector2 targetPos;
|
||||
public Vector3 maxScale = new Vector3(1.3f, 1.3f, 1.3f);
|
||||
public float animSpeed = 25f;
|
||||
public float scaleTime = 5f;
|
||||
|
||||
private bool closing = false;
|
||||
private bool opening = true;
|
||||
|
||||
|
||||
private float interpolationValue;
|
||||
|
||||
private float startTime;
|
||||
private float closeTime;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
startTime = Time.time;
|
||||
|
||||
transform.position = startPos;
|
||||
transform.localScale = new Vector3(0, 0, 0);
|
||||
|
||||
opening = true;
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Vector2 pos = new Vector2(transform.position.x, transform.position.y);
|
||||
|
||||
//interpolationValue = (Time.time - closeTime) / animSpeed;
|
||||
|
||||
|
||||
if (opening)
|
||||
{
|
||||
animatePos();
|
||||
animateScale();
|
||||
|
||||
if(transform.localScale == maxScale)
|
||||
{
|
||||
opening = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (closing)
|
||||
{
|
||||
interpolationValue = (closeTime) / scaleTime;
|
||||
CloseAnim();
|
||||
|
||||
if (pos == startPos)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CloseWindow()
|
||||
{
|
||||
opening = false;
|
||||
closing = true;
|
||||
closeTime = Time.time;
|
||||
}
|
||||
|
||||
|
||||
private void CloseAnim()
|
||||
{
|
||||
transform.position = Vector2.MoveTowards(transform.position, startPos, animSpeed * Time.deltaTime);
|
||||
|
||||
Vector3 trans = Vector3.Lerp(maxScale, Vector3.zero, interpolationValue);
|
||||
transform.localScale = trans;
|
||||
}
|
||||
|
||||
|
||||
private void animatePos()
|
||||
{
|
||||
transform.position = Vector2.MoveTowards(transform.position, targetPos, animSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void animateScale()
|
||||
{
|
||||
transform.localScale = Vector3.Lerp(Vector3.zero, maxScale, 1.38f * (Time.time - startTime));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f14612ff94b813941b9155b1cda63c34
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SceneChanger : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject sceneChangerAnim;
|
||||
|
||||
|
||||
public void EndGameAnim()
|
||||
{
|
||||
sceneChangerAnim.GetComponent<Animator>().SetTrigger("EndGame");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f851e496b8857a43b6884928fb0ed56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,179 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
|
||||
public class SceneDirector : MonoBehaviour
|
||||
{
|
||||
|
||||
private int sceneIndex = 0;
|
||||
|
||||
private int index = 0;
|
||||
|
||||
|
||||
//private bool gameStarted = false;
|
||||
|
||||
public SceneData[] scenes;
|
||||
|
||||
private SceneData activeScene;
|
||||
|
||||
|
||||
public DialogueManager DM;
|
||||
public TaskManager TM;
|
||||
public ElectionsManager EM;
|
||||
|
||||
public SceneChanger SC;
|
||||
|
||||
public DayScreen dayScreen;
|
||||
|
||||
|
||||
|
||||
public GameObject bgImageSprite;
|
||||
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
//StartScene(scenes[sceneIndex]);
|
||||
|
||||
index = 0;
|
||||
sceneIndex = 0;
|
||||
|
||||
StartCoroutine(GameStart());
|
||||
|
||||
}
|
||||
|
||||
public void StartScene(SceneData newSceneData)
|
||||
{
|
||||
|
||||
Debug.Log("Scene Start" + scenes[sceneIndex]);
|
||||
|
||||
index = 0;
|
||||
activeScene = newSceneData;
|
||||
|
||||
|
||||
bgImageSprite.GetComponent<SpriteRenderer>().sprite = activeScene.bgImage;
|
||||
|
||||
|
||||
dayScreen.changeDay(activeScene.sceneName);
|
||||
|
||||
StartCoroutine(SceneStart());
|
||||
|
||||
|
||||
Debug.LogWarning("ActiveSceneLeng" + activeScene.events.Length);
|
||||
|
||||
sceneIndex += 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void NextEvent()
|
||||
{
|
||||
|
||||
//Debug.Log(index < activeScene.events.Length);
|
||||
Debug.Log("Index Before:" + index);
|
||||
|
||||
if (index < activeScene.events.Length)
|
||||
{
|
||||
EventType type = activeScene.events[index];
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case EventType.Election:
|
||||
EM.StartElection();
|
||||
break;
|
||||
|
||||
case EventType.Dialog:
|
||||
DM.StartDialog((Dialogue)activeScene.eventData[index]);
|
||||
|
||||
break;
|
||||
|
||||
case EventType.Tasks:
|
||||
TM.StartTasks((TaskList)activeScene.eventData[index]);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
Debug.LogWarning("No existe esa opcion de cosa en la escena.");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
index += 1;
|
||||
Debug.Log("SceneIndex After: " + index);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
FinishScene();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void FinishEvent()
|
||||
{
|
||||
NextEvent();
|
||||
}
|
||||
|
||||
public void FinishScene()
|
||||
{
|
||||
//Debug.LogWarning("End of Scene" + sceneIndex);
|
||||
|
||||
Debug.LogWarning("-----------------------");
|
||||
|
||||
if(sceneIndex < scenes.Length)
|
||||
{
|
||||
StartScene(scenes[sceneIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
FinishGame();
|
||||
}
|
||||
}
|
||||
|
||||
private void FinishGame()
|
||||
{
|
||||
|
||||
SC.EndGameAnim();
|
||||
StartCoroutine(GameEnd());
|
||||
}
|
||||
|
||||
|
||||
IEnumerator GameStart()
|
||||
{
|
||||
yield return new WaitForSeconds(1.35f);
|
||||
StartScene(scenes[sceneIndex]);
|
||||
}
|
||||
|
||||
|
||||
IEnumerator SceneStart()
|
||||
{
|
||||
yield return new WaitForSeconds(5.35f);
|
||||
NextEvent();
|
||||
}
|
||||
|
||||
|
||||
IEnumerator GameEnd()
|
||||
{
|
||||
yield return new WaitForSeconds(6.5f);
|
||||
SceneManager.LoadScene(2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*IEnumerator sceneOut()
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e75ccec77fd64aa4d9c4633929cf0b84
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ffeb85112e641b43b718701c57d40c3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
[CreateAssetMenu(fileName = "New Character", menuName = "Data/Character")]
|
||||
public class Character : ScriptableObject
|
||||
{
|
||||
|
||||
|
||||
public Sprite[] emociones = new Sprite[4];
|
||||
|
||||
|
||||
//public Sprite portrait;
|
||||
|
||||
public string fullName;
|
||||
|
||||
}
|
||||
|
||||
public enum charFeelings
|
||||
{
|
||||
Normal = 0, enfado = 1, felicidad = 2, extra = 3
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a905bb19f6a269b4b936f2c7402bee0e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public struct TextLine
|
||||
{
|
||||
public Character activeChar;
|
||||
public charFeelings emotion;
|
||||
|
||||
[TextArea(5, 10)]
|
||||
public string sentence;
|
||||
|
||||
}
|
||||
|
||||
|
||||
[CreateAssetMenu(fileName = "New Dialog", menuName = "Data/Dialog")]
|
||||
public class Dialogue : ScriptableObject
|
||||
{
|
||||
|
||||
public Character leftChar;
|
||||
public Character rightChar;
|
||||
|
||||
|
||||
|
||||
public TextLine[] textLines;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5f09799983d4d74eb04046aa4ab73a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class ElectionData
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 25ee42d9817e02143b926dcbbb7f4cbb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "New Scene", menuName = "Data/Scene")]
|
||||
public class SceneData : ScriptableObject
|
||||
{
|
||||
//public int eventIndex = 0;
|
||||
|
||||
[TextArea(2,3)]
|
||||
public string sceneName;
|
||||
|
||||
|
||||
public EventType[] events;
|
||||
|
||||
public ScriptableObject[] eventData;
|
||||
|
||||
public Sprite bgImage;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public enum EventType
|
||||
{
|
||||
Election = 0, Dialog = 1, Tasks = 2
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf980b5929f143f4bab5310ff5f5501c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[CreateAssetMenu(fileName = "New Task", menuName = "Data/Tasks/Task")]
|
||||
public class Task : ScriptableObject
|
||||
{
|
||||
|
||||
public string taskName;
|
||||
public string description;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 896c82d430fd8b9449c695acaf6ab1fb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public struct TaskToDo
|
||||
{
|
||||
public Task task;
|
||||
public GameObject minigameStarter;
|
||||
|
||||
public bool completed;
|
||||
}
|
||||
|
||||
[CreateAssetMenu(fileName = "New taskList", menuName = "Data/Tasks/TaskList")]
|
||||
public class TaskList : ScriptableObject
|
||||
{
|
||||
|
||||
public TaskToDo[] taskList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ce214abb78e2894796046fa4b2957b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class TaskListUI : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d353fe7299a3047469066b62714b88b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,184 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using Unity.Mathematics;
|
||||
|
||||
public class TaskManager : MonoBehaviour
|
||||
{
|
||||
|
||||
private GameObject[] taskElements;
|
||||
|
||||
public GameObject taskItemPrefab;
|
||||
public GameObject instanciateParent;
|
||||
public Vector2 firstElementPos;
|
||||
|
||||
|
||||
public TaskList activeTaskList;
|
||||
|
||||
private int taskIndex = 0;
|
||||
|
||||
|
||||
public void StartTasks(TaskList newTaskList)
|
||||
{
|
||||
taskIndex = 0;
|
||||
|
||||
gameObject.SetActive(true);
|
||||
|
||||
activeTaskList = newTaskList;
|
||||
|
||||
|
||||
GameObject[] gml = GameObject.FindGameObjectsWithTag("TaskElement");
|
||||
|
||||
foreach (GameObject obj in gml)
|
||||
{
|
||||
Destroy(obj);
|
||||
}
|
||||
|
||||
taskElements = new GameObject[10];
|
||||
|
||||
for (int i = 0; i < activeTaskList.taskList.Length; i++)
|
||||
{
|
||||
Vector2 pos = new Vector2(firstElementPos.x, firstElementPos.y - (64 * i));
|
||||
|
||||
taskElements[i] = Instantiate(taskItemPrefab, pos, quaternion.identity, instanciateParent.transform).gameObject;
|
||||
|
||||
//interactObjects[i].obj = Instantiate(activeTaskList.taskList[i].sceneMinigameOpenerPrefab);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Instantiate(activeTaskList.taskList[taskIndex].minigameStarter);
|
||||
|
||||
UpdateTaskList();
|
||||
|
||||
//NewTaskMinigame();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*public void SceneObjectInteraction(GameObject interacted)
|
||||
{
|
||||
for (int i = 0; i < interactObjects.Length; i++)
|
||||
{
|
||||
if (interactObjects[i].obj == interacted && !interactObjects[i].obj.GetComponent<ObjectAnim>().interatuable)
|
||||
{
|
||||
interactObjects[i].completed = true;
|
||||
interacted.GetComponent<ObjectAnim>().interatuable = false;
|
||||
interacted.GetComponent<ObjectAnim>().ResetScale();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = interactObjects.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (!interactObjects[i].completed)
|
||||
{
|
||||
break;
|
||||
}
|
||||
NewTaskMinigame();
|
||||
}
|
||||
|
||||
foreach (objectItaretion objectIt in interactObjects)
|
||||
{
|
||||
|
||||
if (!objectIt.completed)
|
||||
{
|
||||
objectIt.obj.GetComponent<ObjectAnim>().interatuable = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void NewTaskMinigame()
|
||||
{
|
||||
completeTask(activeTaskList.taskList[taskIndex].task);
|
||||
Instantiate(activeTaskList.taskList[taskIndex].minigamePrefab);
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
public void NewTask()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void CompleteTask(Task completedTask)
|
||||
{
|
||||
taskIndex += 1;
|
||||
|
||||
if(taskIndex < activeTaskList.taskList.Length)
|
||||
{
|
||||
GameObject gm = Instantiate(activeTaskList.taskList[taskIndex].minigameStarter);
|
||||
gm.gameObject.GetComponent<SpriteRenderer>().sortingOrder += 1;
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < activeTaskList.taskList.Length; i++)
|
||||
{
|
||||
if(activeTaskList.taskList[i].task == completedTask)
|
||||
{
|
||||
if (!activeTaskList.taskList[i].completed)
|
||||
{
|
||||
activeTaskList.taskList[i].completed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = activeTaskList.taskList.Length - 1; i >= 0; i--)
|
||||
{
|
||||
|
||||
if (!activeTaskList.taskList[i].completed)
|
||||
{
|
||||
break;
|
||||
}
|
||||
EndTaskList();
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
UpdateTaskList();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void UpdateTaskList()
|
||||
{
|
||||
|
||||
instanciateParent.SetActive(true);
|
||||
|
||||
for (int i = 0; i < activeTaskList.taskList.Length; i++)
|
||||
{
|
||||
|
||||
if(activeTaskList.taskList[i].completed == true)
|
||||
{
|
||||
taskElements[i].GetComponent<Animator>().SetTrigger("Completed");
|
||||
}
|
||||
|
||||
string value = ((i + 1) + ".- " + activeTaskList.taskList[i].task.taskName + "\n");
|
||||
|
||||
TMP_Text txt = taskElements[i].gameObject.GetComponent<TMP_Text>();
|
||||
|
||||
txt.text = value;
|
||||
|
||||
|
||||
//taskElements[i].GetComponent<TMP_Text>().text = (i + 1) + ".- " + activeTaskList.taskList[i].task.taskName + "\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void EndTaskList()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
GameObject.FindGameObjectWithTag("SD").GetComponent<SceneDirector>().FinishEvent();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7809b8b1f5912254b8dad78ec64a4ac3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c701de5670521542831f6a26d4bb80d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class EndSceneSystem : MonoBehaviour
|
||||
{
|
||||
|
||||
private AudioSource AS;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
AS = GetComponent<AudioSource>();
|
||||
|
||||
AS.volume = DataSave.musicVol;
|
||||
AS.Play();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void BackToMenuButton()
|
||||
{
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 639b09f13bc4b0c418da3d6f16f7c97b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MenuSystem : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject sceneChanger;
|
||||
|
||||
public Slider musicSlider;
|
||||
public Slider soundSlider;
|
||||
|
||||
|
||||
private AudioSource AS;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
AS = GetComponent<AudioSource>();
|
||||
|
||||
AS.volume = DataSave.musicVol;
|
||||
AS.Play();
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void PlayButton()
|
||||
{
|
||||
sceneChanger.SetActive(true);
|
||||
sceneChanger.GetComponent<Animator>().SetTrigger("PlayGame");
|
||||
|
||||
|
||||
StartCoroutine(WaitPlay());
|
||||
}
|
||||
|
||||
|
||||
public void ExitButton()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void ChangeVol()
|
||||
{
|
||||
DataSave.soundVol = soundSlider.value;
|
||||
DataSave.musicVol = musicSlider.value;
|
||||
|
||||
AS.volume = DataSave.musicVol;
|
||||
}
|
||||
|
||||
|
||||
IEnumerator WaitPlay()
|
||||
{
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public enum VolType
|
||||
{
|
||||
music = 0, sound = 1
|
||||
}
|
||||
|
||||
|
||||
public static class DataSave
|
||||
{
|
||||
public static float musicVol = 75;
|
||||
public static float soundVol = 75;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e74376d3c33fb8747bf010a8730f1df8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MusicEmiter : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
|
||||
private AudioSource AS;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
AS = GetComponent<AudioSource>();
|
||||
|
||||
AS.volume = DataSave.musicVol;
|
||||
|
||||
AS.Play();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 387123af3753e1847b9b07a4f4abe2b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user