Added basic scene switching, v.1.3.0
This commit is contained in:
parent
46e1a5936b
commit
bb052cef6b
@ -32,7 +32,7 @@ Transform:
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 7573435787306895636}
|
||||
m_RootOrder: 1
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &592371478074520587
|
||||
MeshFilter:
|
||||
@ -140,7 +140,6 @@ Transform:
|
||||
m_LocalPosition: {x: -109.4, y: 0, z: 0}
|
||||
m_LocalScale: {x: 10, y: 1, z: 10}
|
||||
m_Children:
|
||||
- {fileID: 8609180617711193000}
|
||||
- {fileID: 1418724594657166519}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
@ -220,77 +219,3 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: c137a267f9c5b424ba76ed1d54cde205, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &8609180617711325480
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 7573435787306895636}
|
||||
m_Modifications:
|
||||
- target: {fileID: 100000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: WaterBasicDaytime
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 100000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 7
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 7
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
--- !u!4 &8609180617711193000 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 400000, guid: 9485b0c79d11e2e4d0007da98d76c639, type: 3}
|
||||
m_PrefabInstance: {fileID: 8609180617711325480}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
||||
95
Assets/Resources/skillTree.json
Normal file
95
Assets/Resources/skillTree.json
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"Warrior":{
|
||||
"first":{
|
||||
"first":{
|
||||
"name":"Slash",
|
||||
"baseDamage":"20",
|
||||
"secondaryConsumption":"10",
|
||||
"cooldown":"2",
|
||||
"description":"A basic slash. But better than a basic attack",
|
||||
"skillIcon":"Skills/Warrior/Slash",
|
||||
"skillAnimation":""
|
||||
},
|
||||
"second":{
|
||||
"name":"Block",
|
||||
"baseDamage":"0",
|
||||
"secondaryConsumption":"5",
|
||||
"cooldown":"1",
|
||||
"description":"Block the next attack",
|
||||
"skillIcon":"Skills/Warrior/Block",
|
||||
"skillAnimation":""
|
||||
},
|
||||
"third":{
|
||||
"name":"Execution",
|
||||
"baseDamage":"35",
|
||||
"secondaryConsumption":"30",
|
||||
"cooldown":"4",
|
||||
"description":"A powerful skill. But hard to cast early",
|
||||
"skillIcon":"Skills/Warrior/Execution",
|
||||
"skillAnimation":""
|
||||
}
|
||||
}
|
||||
},
|
||||
"Mage":{
|
||||
"first":{
|
||||
"first":{
|
||||
"name":"Icicle",
|
||||
"baseDamage":"20",
|
||||
"secondaryConsumption":"10",
|
||||
"cooldown":"2",
|
||||
"description":"Small icicles to cut down your enemies HP",
|
||||
"skillIcon":"Skills/Mage/Icicle",
|
||||
"skillAnimation":""
|
||||
},
|
||||
"second":{
|
||||
"name":"Teleport",
|
||||
"baseDamage":"0",
|
||||
"secondaryConsumption":"5",
|
||||
"cooldown":"1",
|
||||
"description":"Evade the next attack",
|
||||
"skillIcon":"Skills/Mage/Teleport",
|
||||
"skillAnimation":""
|
||||
},
|
||||
"third":{
|
||||
"name":"Fireball",
|
||||
"baseDamage":"35",
|
||||
"secondaryConsumption":"30",
|
||||
"cooldown":"4",
|
||||
"description":"What a big fireball. Does some good damage",
|
||||
"skillIcon":"Skills/Mage/Fireball",
|
||||
"skillAnimation":""
|
||||
}
|
||||
}
|
||||
},
|
||||
"Thieve":{
|
||||
"first":{
|
||||
"first":{
|
||||
"name":"Stab",
|
||||
"baseDamage":"20",
|
||||
"secondaryConsumption":"10",
|
||||
"cooldown":"2",
|
||||
"description":"Early skill to apply some damage.",
|
||||
"skillIcon":"Skills/Thief/Stab",
|
||||
"skillAnimation":""
|
||||
},
|
||||
"second":{
|
||||
"name":"SmokeScreen",
|
||||
"baseDamage":"0",
|
||||
"secondaryConsumption":"5",
|
||||
"cooldown":"1",
|
||||
"description":"Hide from the next attack",
|
||||
"skillIcon":"Skills/Thief/SmokeScreen",
|
||||
"skillAnimation":""
|
||||
},
|
||||
"third":{
|
||||
"name":"Heartstop",
|
||||
"baseDamage":"35",
|
||||
"secondaryConsumption":"30",
|
||||
"cooldown":"4",
|
||||
"description":"Stop the heart of your enemy. High damage.",
|
||||
"skillIcon":"Skills/Thief/Heartstop",
|
||||
"skillAnimation":""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
Assets/Resources/skillTree.json.meta
Normal file
7
Assets/Resources/skillTree.json.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 494666e09b3551e488b2c5b241180175
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
14780
Assets/Scenes/MenuScene.unity
Normal file
14780
Assets/Scenes/MenuScene.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/MenuScene.unity.meta
Normal file
7
Assets/Scenes/MenuScene.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5798649eb46a4c64c99b5ba3d27c0bbb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -19,21 +19,6 @@ namespace Assets.Scripts
|
||||
audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandler>();
|
||||
}
|
||||
|
||||
public void startGame()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.openIntroduction();
|
||||
}
|
||||
|
||||
public void closeGame()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#endif
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public void openOptions()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
@ -47,18 +32,6 @@ namespace Assets.Scripts
|
||||
uihandler.closeOptions();
|
||||
}
|
||||
|
||||
public void openCreation()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.openCharacterCreation();
|
||||
}
|
||||
|
||||
public void closeCreation()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.closeCharacterCreation();
|
||||
}
|
||||
|
||||
public void exitToMenu()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
|
||||
8
Assets/Scripts/Menu.meta
Normal file
8
Assets/Scripts/Menu.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3660ef3ed8f6a07468d22005f6f2e496
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
70
Assets/Scripts/Menu/ButtonHandlerMenu.cs
Normal file
70
Assets/Scripts/Menu/ButtonHandlerMenu.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.Menu
|
||||
{
|
||||
public class ButtonHandlerMenu : MonoBehaviour
|
||||
{
|
||||
UIHandlerMenu uihandler;
|
||||
AudioHandler audioHandler;
|
||||
SceneHandler sceneHandler;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
uihandler = GameObject.Find("UIHandler").GetComponent<UIHandlerMenu>();
|
||||
audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandler>();
|
||||
sceneHandler = GameObject.Find("SceneHandlerLoaded").GetComponent<SceneHandler>();
|
||||
}
|
||||
|
||||
public void startGame()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.startGame(sceneHandler);
|
||||
}
|
||||
|
||||
public void closeGame()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.isPlaying = false;
|
||||
#endif
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
public void openOptions()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.openOptions();
|
||||
}
|
||||
|
||||
public void closeOptions()
|
||||
{
|
||||
audioHandler.loadAudioSettings();
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.closeOptions();
|
||||
}
|
||||
|
||||
public void openCreation()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.openCharacterCreation();
|
||||
}
|
||||
|
||||
public void closeCreation()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.closeCharacterCreation();
|
||||
}
|
||||
|
||||
public void saveOptions()
|
||||
{
|
||||
audioHandler.playButtonClick();
|
||||
uihandler.adaptScreen();
|
||||
audioHandler.saveAudioSettings();
|
||||
uihandler.closeOptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Menu/ButtonHandlerMenu.cs.meta
Normal file
11
Assets/Scripts/Menu/ButtonHandlerMenu.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6e81e6787d831a4d98448435186e09e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
178
Assets/Scripts/Menu/UIHandlerMenu.cs
Normal file
178
Assets/Scripts/Menu/UIHandlerMenu.cs
Normal file
@ -0,0 +1,178 @@
|
||||
using Assets.Scripts.Classes;
|
||||
using Assets.Scripts.Races;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Assets.Scripts.Menu
|
||||
{
|
||||
public class UIHandlerMenu : MonoBehaviour
|
||||
{
|
||||
public GameObject mainMenu;
|
||||
public GameObject options;
|
||||
public GameObject characterCreation;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
options.SetActive(false);
|
||||
characterCreation.SetActive(false);
|
||||
mainMenu.SetActive(true);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void startGame(SceneHandler sceneHandler)
|
||||
{
|
||||
int cityAmount = 0;
|
||||
switch (GameObject.Find("dropSize").GetComponent<Dropdown>().value)
|
||||
{
|
||||
case 0:
|
||||
cityAmount = 5;
|
||||
break;
|
||||
case 1:
|
||||
cityAmount = 10;
|
||||
break;
|
||||
case 2:
|
||||
cityAmount = 20;
|
||||
break;
|
||||
case 3:
|
||||
cityAmount = 40;
|
||||
break;
|
||||
}
|
||||
PlayerPrefs.SetInt("cityAmount", cityAmount);
|
||||
PlayerPrefs.SetInt("class", GameObject.Find("dropClass").GetComponent<Dropdown>().value);
|
||||
PlayerPrefs.SetInt("race", GameObject.Find("dropRace").GetComponent<Dropdown>().value);
|
||||
PlayerPrefs.SetString("playername", GameObject.Find("inName").GetComponent<InputField>().text);
|
||||
PlayerPrefs.SetInt("difficulty", GameObject.Find("dropDifficulty").GetComponent<Dropdown>().value);
|
||||
sceneHandler.openGameScene();
|
||||
}
|
||||
|
||||
private void setPlayerInformation()
|
||||
{
|
||||
string name = GameObject.Find("inName").GetComponent<InputField>().text;
|
||||
int role = GameObject.Find("dropClass").GetComponent<Dropdown>().value;
|
||||
int race = GameObject.Find("dropRace").GetComponent<Dropdown>().value;
|
||||
BasicRace playerRace = new BasicRace();
|
||||
BasicClass playerClass = new BasicClass();
|
||||
switch (role)
|
||||
{
|
||||
case 0:
|
||||
playerClass = new WarriorClass();
|
||||
break;
|
||||
case 1:
|
||||
playerClass = new MageClass();
|
||||
break;
|
||||
case 2:
|
||||
playerClass = new ThiefClass();
|
||||
break;
|
||||
}
|
||||
switch (race)
|
||||
{
|
||||
case 0:
|
||||
playerRace = new HumanRace();
|
||||
break;
|
||||
case 1:
|
||||
playerRace = new ElvenRace();
|
||||
break;
|
||||
case 2:
|
||||
playerRace = new DwarvenRace();
|
||||
break;
|
||||
case 3:
|
||||
playerRace = new GoblinRace();
|
||||
break;
|
||||
case 4:
|
||||
playerRace = new GiantRace();
|
||||
break;
|
||||
}
|
||||
GameObject.Find("Player").GetComponent<Player>().generatePlayer(playerRace, playerClass, name, GameObject.Find("dropDifficulty").GetComponent<Dropdown>().value);
|
||||
}
|
||||
|
||||
public void openCharacterCreation()
|
||||
{
|
||||
characterCreation.SetActive(true);
|
||||
mainMenu.SetActive(false);
|
||||
}
|
||||
|
||||
public void closeCharacterCreation()
|
||||
{
|
||||
characterCreation.SetActive(false);
|
||||
mainMenu.SetActive(true);
|
||||
}
|
||||
|
||||
public void openOptions()
|
||||
{
|
||||
options.SetActive(true);
|
||||
mainMenu.SetActive(false);
|
||||
GameObject.Find("AudioHandler").GetComponent<AudioHandler>().setSlider();
|
||||
GameObject.Find("ScrollbarOptions").GetComponent<Scrollbar>().value = 1f;
|
||||
}
|
||||
|
||||
public void closeOptions()
|
||||
{
|
||||
options.SetActive(false);
|
||||
mainMenu.SetActive(true);
|
||||
}
|
||||
|
||||
public void adaptScreen()
|
||||
{
|
||||
GameObject resolution = GameObject.Find("dropResolution");
|
||||
GameObject mode = GameObject.Find("dropMode");
|
||||
|
||||
switch (resolution.GetComponent<Dropdown>().value)
|
||||
{
|
||||
case 0:
|
||||
Screen.SetResolution(800, 600, Screen.fullScreenMode);
|
||||
break;
|
||||
case 1:
|
||||
Screen.SetResolution(1280, 800, Screen.fullScreenMode);
|
||||
break;
|
||||
case 2:
|
||||
Screen.SetResolution(1920, 1080, Screen.fullScreenMode);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (mode.GetComponent<Dropdown>().value)
|
||||
{
|
||||
case 0:
|
||||
if (Screen.fullScreenMode != FullScreenMode.Windowed)
|
||||
{
|
||||
Screen.fullScreenMode = FullScreenMode.Windowed;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (Screen.fullScreenMode != FullScreenMode.ExclusiveFullScreen)
|
||||
{
|
||||
Screen.fullScreenMode = FullScreenMode.ExclusiveFullScreen;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (Screen.fullScreenMode != FullScreenMode.FullScreenWindow)
|
||||
{
|
||||
Screen.fullScreenMode = FullScreenMode.FullScreenWindow;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateCreationInformation()
|
||||
{
|
||||
setPlayerInformation();
|
||||
|
||||
// health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience, points
|
||||
int[] playerstats = GameObject.Find("Player").GetComponent<Player>().getStats();
|
||||
|
||||
GameObject.Find("txtStrength_Creation").GetComponent<Text>().text = "Strength: " + playerstats[4];
|
||||
GameObject.Find("txtDexterity_Creation").GetComponent<Text>().text = "Dexterity: " + playerstats[5];
|
||||
GameObject.Find("txtIntelligence_Creation").GetComponent<Text>().text = "Intelligence: " + playerstats[6];
|
||||
GameObject.Find("txtHealth_Creation").GetComponent<Text>().text = "Health: " + playerstats[1];
|
||||
GameObject.Find("txtSecondary_Creation").GetComponent<Text>().text = "Mana: " + playerstats[3];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Menu/UIHandlerMenu.cs.meta
Normal file
11
Assets/Scripts/Menu/UIHandlerMenu.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6b8dcdcfecec7941902e305daff9eb9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -47,6 +47,13 @@ namespace Assets.Scripts
|
||||
audioHandler = GameObject.Find("AudioHandler").GetComponent<AudioHandler>();
|
||||
}
|
||||
|
||||
public void finishPlayerCreation()
|
||||
{
|
||||
killcount = 0;
|
||||
generateSkills();
|
||||
EasterEggHandler.applyEasterEgg(this);
|
||||
}
|
||||
|
||||
public void generatePlayer(BasicRace race, BasicClass role, string name, int difficulty)
|
||||
{
|
||||
playername = name;
|
||||
@ -60,14 +67,59 @@ namespace Assets.Scripts
|
||||
experience = 0;
|
||||
maxExperience = 10;
|
||||
level = 0;
|
||||
killcount = 0;
|
||||
this.race = race;
|
||||
this.race.applyBonus(this);
|
||||
this.role = role;
|
||||
this.role.applyBonus(this);
|
||||
this.difficulty = difficulty;
|
||||
generateSkills();
|
||||
EasterEggHandler.applyEasterEgg(this);
|
||||
}
|
||||
|
||||
public void generatePlayer()
|
||||
{
|
||||
switch (PlayerPrefs.GetInt("class"))
|
||||
{
|
||||
case 0:
|
||||
role = new WarriorClass();
|
||||
break;
|
||||
case 1:
|
||||
role = new MageClass();
|
||||
break;
|
||||
case 2:
|
||||
role = new ThiefClass();
|
||||
break;
|
||||
}
|
||||
switch (PlayerPrefs.GetInt("race"))
|
||||
{
|
||||
case 0:
|
||||
race = new HumanRace();
|
||||
break;
|
||||
case 1:
|
||||
race = new ElvenRace();
|
||||
break;
|
||||
case 2:
|
||||
race = new DwarvenRace();
|
||||
break;
|
||||
case 3:
|
||||
race = new GoblinRace();
|
||||
break;
|
||||
case 4:
|
||||
race = new GiantRace();
|
||||
break;
|
||||
}
|
||||
playername = PlayerPrefs.GetString("playername");
|
||||
health = 100;
|
||||
maxHealth = 100;
|
||||
maxSecondary = 20;
|
||||
secondary = 20;
|
||||
strength = 5;
|
||||
dexterity = 5;
|
||||
intelligence = 5;
|
||||
experience = 0;
|
||||
maxExperience = 10;
|
||||
level = 0;
|
||||
this.race.applyBonus(this);
|
||||
this.role.applyBonus(this);
|
||||
this.difficulty = PlayerPrefs.GetInt("difficulty");
|
||||
}
|
||||
|
||||
private void generateSkills()
|
||||
@ -490,5 +542,20 @@ namespace Assets.Scripts
|
||||
{
|
||||
return playername;
|
||||
}
|
||||
|
||||
public int getDifficulty()
|
||||
{
|
||||
return difficulty;
|
||||
}
|
||||
|
||||
public BasicRace getRace()
|
||||
{
|
||||
return race;
|
||||
}
|
||||
|
||||
public BasicClass getClass()
|
||||
{
|
||||
return role;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
62
Assets/Scripts/SceneHandler.cs
Normal file
62
Assets/Scripts/SceneHandler.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using Assets.Scripts.Races;
|
||||
using Assets.Scripts.Classes;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Assets.Scripts
|
||||
{
|
||||
public class SceneHandler : MonoBehaviour
|
||||
{
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
bool hasSceneHandler = false;
|
||||
foreach (Object o in FindObjectsOfType(typeof(MonoBehaviour)))
|
||||
{
|
||||
if (o.name == "SceneHandlerLoaded")
|
||||
{
|
||||
hasSceneHandler = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasSceneHandler)
|
||||
{
|
||||
DontDestroyOnLoad(this.gameObject);
|
||||
this.gameObject.name = "SceneHandlerLoaded";
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void openMenuScene()
|
||||
{
|
||||
SceneManager.LoadScene("MenuScene");
|
||||
}
|
||||
|
||||
public void openGameScene()
|
||||
{
|
||||
SceneManager.LoadScene("GameScene");
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
if (scene.name == "GameScene")
|
||||
{
|
||||
GameObject.Find("UIHandler").GetComponent<UIHandler>().openIntroduction();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/SceneHandler.cs.meta
Normal file
11
Assets/Scripts/SceneHandler.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e6f2701c6e622a42aba50dab602e362
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -16,9 +16,7 @@ namespace Assets.Scripts
|
||||
public GameObject message;
|
||||
public GameObject charactersheet;
|
||||
public GameObject deathscreen;
|
||||
public GameObject mainMenu;
|
||||
public GameObject options;
|
||||
public GameObject characterCreation;
|
||||
public GameObject pauseMenu;
|
||||
public GameObject playerHUD;
|
||||
public GameObject questlog;
|
||||
@ -33,9 +31,7 @@ namespace Assets.Scripts
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
options.SetActive(false);
|
||||
hideOtherElements(mainMenu);
|
||||
state = UIState.MAINMENU;
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@ -99,69 +95,9 @@ namespace Assets.Scripts
|
||||
public void startGame()
|
||||
{
|
||||
introduction.transform.localScale = new Vector3(0, 0, 0);
|
||||
int index = GameObject.Find("dropSize").GetComponent<Dropdown>().value;
|
||||
int cityAmount = 0;
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
cityAmount = 5;
|
||||
break;
|
||||
case 1:
|
||||
cityAmount = 10;
|
||||
break;
|
||||
case 2:
|
||||
cityAmount = 20;
|
||||
break;
|
||||
case 3:
|
||||
cityAmount = 40;
|
||||
break;
|
||||
}
|
||||
GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(cityAmount);
|
||||
setPlayerInformation();
|
||||
tutorial.transform.localScale = new Vector3(1, 1, 1);
|
||||
showHUD();
|
||||
state = UIState.GAME;
|
||||
EventSystem.current.SetSelectedGameObject(null);
|
||||
}
|
||||
|
||||
private void setPlayerInformation()
|
||||
{
|
||||
string name = GameObject.Find("inName").GetComponent<InputField>().text;
|
||||
int role = GameObject.Find("dropClass").GetComponent<Dropdown>().value;
|
||||
int race = GameObject.Find("dropRace").GetComponent<Dropdown>().value;
|
||||
BasicRace playerRace = new BasicRace();
|
||||
BasicClass playerClass = new BasicClass();
|
||||
switch (role)
|
||||
{
|
||||
case 0:
|
||||
playerClass = new WarriorClass();
|
||||
break;
|
||||
case 1:
|
||||
playerClass = new MageClass();
|
||||
break;
|
||||
case 2:
|
||||
playerClass = new ThiefClass();
|
||||
break;
|
||||
}
|
||||
switch (race)
|
||||
{
|
||||
case 0:
|
||||
playerRace = new HumanRace();
|
||||
break;
|
||||
case 1:
|
||||
playerRace = new ElvenRace();
|
||||
break;
|
||||
case 2:
|
||||
playerRace = new DwarvenRace();
|
||||
break;
|
||||
case 3:
|
||||
playerRace = new GoblinRace();
|
||||
break;
|
||||
case 4:
|
||||
playerRace = new GiantRace();
|
||||
break;
|
||||
}
|
||||
GameObject.Find("Player").GetComponent<Player>().generatePlayer(playerRace, playerClass, name, GameObject.Find("dropDifficulty").GetComponent<Dropdown>().value);
|
||||
}
|
||||
|
||||
public void switchCharactersheet()
|
||||
@ -176,49 +112,20 @@ namespace Assets.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
public void openCharacterCreation()
|
||||
{
|
||||
mainMenu.transform.localScale = new Vector3(0, 0, 0);
|
||||
characterCreation.transform.localScale = new Vector3(1, 1, 1);
|
||||
state = UIState.CHARACTERCREATION;
|
||||
}
|
||||
|
||||
public void closeCharacterCreation()
|
||||
{
|
||||
characterCreation.transform.localScale = new Vector3(0, 0, 0);
|
||||
state = UIState.MAINMENU;
|
||||
openMainMenu();
|
||||
}
|
||||
|
||||
public void openOptions()
|
||||
{
|
||||
options.SetActive(true);
|
||||
GameObject.Find("AudioHandler").GetComponent<AudioHandler>().setSlider();
|
||||
hideOtherElements(options);
|
||||
if (state == UIState.MAINMENU)
|
||||
{
|
||||
state = UIState.OPTIONS;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = UIState.PAUSEOPTIONS;
|
||||
}
|
||||
state = UIState.PAUSEOPTIONS;
|
||||
GameObject.Find("ScrollbarOptions").GetComponent<Scrollbar>().value = 1f;
|
||||
}
|
||||
|
||||
public void closeOptions()
|
||||
{
|
||||
options.SetActive(false);
|
||||
if (state == UIState.PAUSEOPTIONS)
|
||||
{
|
||||
state = UIState.PAUSE;
|
||||
openPauseMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
state = UIState.MAINMENU;
|
||||
openMainMenu();
|
||||
}
|
||||
state = UIState.PAUSE;
|
||||
openPauseMenu();
|
||||
}
|
||||
|
||||
public void openCharactersheet()
|
||||
@ -257,8 +164,7 @@ namespace Assets.Scripts
|
||||
|
||||
public void openMainMenu()
|
||||
{
|
||||
hideOtherElements(mainMenu);
|
||||
state = UIState.MAINMENU;
|
||||
GameObject.Find("SceneHandlerLoaded").GetComponent<SceneHandler>().openMenuScene();
|
||||
}
|
||||
|
||||
public void switchPauseMenu()
|
||||
@ -385,7 +291,7 @@ namespace Assets.Scripts
|
||||
{
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
if (obj != fight && state != UIState.CHARACTERCREATION && state != UIState.MAINMENU)
|
||||
if (obj != fight)
|
||||
{
|
||||
showHUD();
|
||||
}
|
||||
@ -571,25 +477,14 @@ namespace Assets.Scripts
|
||||
|
||||
public void openIntroduction()
|
||||
{
|
||||
GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(PlayerPrefs.GetInt("cityAmount"));
|
||||
GameObject.Find("Player").GetComponent<Player>().generatePlayer();
|
||||
GameObject.Find("Player").GetComponent<Player>().finishPlayerCreation();
|
||||
updatePlayerHUD();
|
||||
hideOtherElements(introduction);
|
||||
state = UIState.TUTORIAL;
|
||||
}
|
||||
|
||||
public void updateCreationInformation()
|
||||
{
|
||||
setPlayerInformation();
|
||||
|
||||
// health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience, points
|
||||
int[] playerstats = GameObject.Find("Player").GetComponent<Player>().getStats();
|
||||
|
||||
GameObject.Find("txtStrength_Creation").GetComponent<Text>().text = "Strength: " + playerstats[4];
|
||||
GameObject.Find("txtDexterity_Creation").GetComponent<Text>().text = "Dexterity: " + playerstats[5];
|
||||
GameObject.Find("txtIntelligence_Creation").GetComponent<Text>().text = "Intelligence: " + playerstats[6];
|
||||
GameObject.Find("txtHealth_Creation").GetComponent<Text>().text = "Health: " + playerstats[1];
|
||||
GameObject.Find("txtSecondary_Creation").GetComponent<Text>().text = "Mana: " + playerstats[3];
|
||||
|
||||
}
|
||||
|
||||
public void closeTutorial()
|
||||
{
|
||||
tutorial.transform.localScale = new Vector3(0,0,0);
|
||||
|
||||
@ -8,9 +8,7 @@ namespace Assets.Scripts
|
||||
{
|
||||
public enum UIState
|
||||
{
|
||||
MAINMENU,
|
||||
FIGHT,
|
||||
CHARACTERCREATION,
|
||||
CHARACTER,
|
||||
DEATH,
|
||||
OPTIONS,
|
||||
|
||||
@ -40,11 +40,14 @@ public class WorldGenerator : MonoBehaviour
|
||||
|
||||
public void resetGame(int cityAmount)
|
||||
{
|
||||
foreach (GameObject tile in tiles.Values)
|
||||
if (tiles != null)
|
||||
{
|
||||
if (tile.name != "Spawn")
|
||||
foreach (GameObject tile in tiles.Values)
|
||||
{
|
||||
Destroy(tile);
|
||||
if (tile.name != "Spawn")
|
||||
{
|
||||
Destroy(tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.transform.position = new Vector3(0,1.5f,0);
|
||||
|
||||
@ -4,5 +4,11 @@
|
||||
EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes: []
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/MenuScene.unity
|
||||
guid: 5798649eb46a4c64c99b5ba3d27c0bbb
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/GameScene.unity
|
||||
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||
m_configObjects: {}
|
||||
|
||||
@ -9,10 +9,19 @@ EditorUserSettings:
|
||||
value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-1:
|
||||
value: 22424703114646680e0b0227036c78111b122b292926237e38271427fb
|
||||
value: 22424703114646680e0b0227036c7919111f0c192f2d2835633c133af6f9
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-2:
|
||||
value: 22424703114646680e0b0227036c7919111f0c192f2d2835633c133af6f9
|
||||
value: 22424703114646680e0b0227036c771f03041d192f2d2835633c133af6f9
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-3:
|
||||
value: 22424703114646680e0b0227036c72111f19352f223d68252320092a
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-4:
|
||||
value: 22424703114646680e0b0227036c78111b122b292926237e38271427fb
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-5:
|
||||
value: 22424703114646680e0b0227036c721518022b292926237e38271427fb
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user