1
0
Fork 0

Merge remote-tracking branch 'origin/PiegamesDev' into PiegamesDev

This commit is contained in:
Triceraptodactyl 2018-04-23 17:25:27 +02:00
commit 03f388e4f0
27 changed files with 686 additions and 86 deletions

View file

@ -52,7 +52,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1303102899095328}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 7.6580257, y: 3.506653, z: -0.08491792}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4615957218218632}

View file

@ -113,6 +113,131 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &30160409
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 30160410}
- component: {fileID: 30160411}
m_Layer: 0
m_Name: menu
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &30160410
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 30160409}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 120074943}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &30160411
AudioSource:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 30160409}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &120074942
GameObject:
m_ObjectHideFlags: 0
@ -140,6 +265,7 @@ Transform:
m_Children:
- {fileID: 1600556434}
- {fileID: 801288608}
- {fileID: 30160410}
m_Father: {fileID: 734498092}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -497,6 +623,11 @@ Prefab:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 60772848946696534, guid: 3d1911457c1e44f53b6b4044334db52f,
type: 2}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
m_IsPrefabParent: 0
@ -595,6 +726,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5d9a051e822e2cf4ea3ca01c5a4df37c, type: 3}
m_Name:
m_EditorClassIdentifier:
followSpeed: 0.05
minZoom: 5
zoomFactor: 4
zoomSpeed: 0.05
startingDist: 5
followThis: {fileID: 0}
--- !u!114 &881384373
MonoBehaviour:
@ -608,13 +744,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
mixer: {fileID: 24100000, guid: efb934a745665924d8c7dd46c0a117ae, type: 2}
maintheme: {fileID: 24500006, guid: efb934a745665924d8c7dd46c0a117ae, type: 2}
end: {fileID: 245089854461186482, guid: efb934a745665924d8c7dd46c0a117ae, type: 2}
maintheme: {fileID: 1600556435}
menutheme: {fileID: 30160411}
gameovers: {fileID: 801288609}
soundeffects:
- {fileID: 1908750963}
- {fileID: 368878861}
- {fileID: 801288609}
- {fileID: 1908750963}
--- !u!1 &1028937042
GameObject:
m_ObjectHideFlags: 0
@ -840,7 +976,7 @@ Prefab:
- target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743,
type: 2}
propertyPath: m_AnchoredPosition.x
value: 67.14285
value: 65.89836
objectReference: {fileID: 0}
- target: {fileID: 224150154901314796, guid: 460d856ea4eb14cedb5fecde1fe6d743,
type: 2}
@ -889,15 +1025,15 @@ Prefab:
m_Modifications:
- target: {fileID: 4612758478389004, guid: 4c5ecfd27b4038941a6e493a8117ea0a, type: 2}
propertyPath: m_LocalPosition.x
value: 7.6580257
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4612758478389004, guid: 4c5ecfd27b4038941a6e493a8117ea0a, type: 2}
propertyPath: m_LocalPosition.y
value: 3.506653
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4612758478389004, guid: 4c5ecfd27b4038941a6e493a8117ea0a, type: 2}
propertyPath: m_LocalPosition.z
value: -0.08491792
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4612758478389004, guid: 4c5ecfd27b4038941a6e493a8117ea0a, type: 2}
propertyPath: m_LocalRotation.x
@ -919,6 +1055,10 @@ Prefab:
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 1303102899095328, guid: 4c5ecfd27b4038941a6e493a8117ea0a, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4c5ecfd27b4038941a6e493a8117ea0a, type: 2}
m_IsPrefabParent: 0
@ -959,9 +1099,10 @@ AudioSource:
m_GameObject: {fileID: 1600556433}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: c89601ee48d799943a756d1d15cd4954, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
@ -1239,6 +1380,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 87d25c2cd3eb97749b79f2cb5f7c5cea, type: 3}
m_Name:
m_EditorClassIdentifier:
scorpion: {fileID: 1303102899095328, guid: 4c5ecfd27b4038941a6e493a8117ea0a, type: 2}
BorderOuter: {fileID: 1062532744197412, guid: bc306521f11be424f9833117977b4319,
type: 2}
BorderInner: {fileID: 1893245914782828, guid: 7326753bf2b213d4e8c2ee93d78ba7d9,

View file

@ -113,6 +113,131 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &52367873
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 52367874}
- component: {fileID: 52367875}
m_Layer: 0
m_Name: menu
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &52367874
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 52367873}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 792683703}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &52367875
AudioSource:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 52367873}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &287217883
GameObject:
m_ObjectHideFlags: 0
@ -524,6 +649,7 @@ Transform:
m_Children:
- {fileID: 923869162}
- {fileID: 287217884}
- {fileID: 52367874}
m_Father: {fileID: 1926562125}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -564,9 +690,10 @@ AudioSource:
m_GameObject: {fileID: 923869161}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: c89601ee48d799943a756d1d15cd4954, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
@ -871,10 +998,13 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
mixer: {fileID: 24100000, guid: efb934a745665924d8c7dd46c0a117ae, type: 2}
maintheme: {fileID: 24500006, guid: efb934a745665924d8c7dd46c0a117ae, type: 2}
end: {fileID: 245089854461186482, guid: efb934a745665924d8c7dd46c0a117ae, type: 2}
maintheme: {fileID: 923869163}
menutheme: {fileID: 52367875}
gameovers: {fileID: 287217885}
soundeffects: []
soundeffects:
- {fileID: 1187801173}
- {fileID: 987581542}
- {fileID: 429380406}
--- !u!1 &1039057777
GameObject:
m_ObjectHideFlags: 0
@ -1360,7 +1490,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
notifications: {fileID: 0}
gameOverPanel: {fileID: 0}
restartUIPanel: {fileID: 0}
healthcontroller: {fileID: 0}
mainMenuSceneIndex: 0
--- !u!1 &1586619316
@ -1757,6 +1887,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
notifications: {fileID: 0}
gameOverPanel: {fileID: 0}
restartUIPanel: {fileID: 0}
healthcontroller: {fileID: 0}
mainMenuSceneIndex: 0

View file

@ -6,22 +6,50 @@ using UnityEngine.Audio;
public class AudioControl : MonoBehaviour
{
public AudioMixer mixer;
public AudioMixerSnapshot maintheme;
public AudioMixerSnapshot end;
public AudioSource maintheme;
public AudioSource menutheme;
public AudioSource gameovers;
public AudioSource[] soundeffects;
public enum Sfx { shoot, explosion, mobattack};
public enum Sfx { shoot, explosion, mobattack };
private float m_TransitionIn;
private float m_TransitionOut;
private bool endstate;
private const float lvlbgm = 6.79f;
private const float gobgm = 14.406f;
private const float loopdelay = 0.05f;
private bool menu;
// Use this for initialization
void Start()
{
m_TransitionIn = 1.2f;
m_TransitionOut = 0.3f;
maintheme.loop = true;
menutheme.loop = true;
gameovers.loop = true;
}
private void Update()
{
if (maintheme.time >= maintheme.clip.length - loopdelay)
maintheme.time = lvlbgm;
if (gameovers.time >= gameovers.clip.length - loopdelay)
gameovers.time = gobgm;
}
public void GameOverBgm()
{
maintheme.Stop();
gameovers.Play();
}
public void MenuBgm()
{
if (gameovers.isPlaying)
gameovers.Stop();
menutheme.Play();
}
public void LevelBgm()
{
maintheme.Play();
}
public void SfxPlay(int sound)
@ -42,4 +70,15 @@ public class AudioControl : MonoBehaviour
{
mixer.SetFloat("masterVolume", Mathf.Clamp(nvol, -80f, 20f));
}
public void SetBgmVolume(float nvol)
{
mixer.SetFloat("bgmVolume", Mathf.Clamp(nvol, -80f, 20f));
}
public void SetSfxVolume(float nvol)
{
mixer.SetFloat("sfxVolume", Mathf.Clamp(nvol, -80f, 20f));
}
}

View file

@ -28,16 +28,15 @@ public class BrakeBarController : MonoBehaviour {
private void UpdatePointer()
{
if (Input.GetKey(KeyCode.S))
while (Input.GetKey(KeyCode.S))
{
firstTime = Time.time;
firstTime += 1;
}
if (Input.GetKeyUp(KeyCode.S))
{
secondTime = Time.time;
float difference = secondTime - firstTime;
gameObject.transform.Rotate(Vector3.forward, difference);
gameObject.transform.Rotate(Vector3.forward, firstTime);
}

View file

@ -65,13 +65,15 @@ public class Door : MonoBehaviour {
/// <param name="collision"></param>
private void OnTriggerExit2D(Collider2D collision) {
if ( collision.tag == "Player") {
// TODO better checks
Player player = collision.gameObject.GetComponent<Player>();
if ((boundingBox.offset - parent.GetCenter()).sqrMagnitude < ((Vector2) player.transform.position - parent.GetCenter()).sqrMagnitude)
return;
Debug.Log("Leaving Trigger");
if(parent == null) {
Debug.Log("This door has no parent Room!");
return;
}
parent.OnPlayerEnter(collision.gameObject.GetComponent<Player>());
parent.OnPlayerEnter(player);
}
}
}

View file

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Assets.Scripts.Entities.Attack;
namespace Assets.Scripts.Entities {
public class Bug : Enemy {
public Bug() : base(15) {
}
private void Start() {
SetAttack(new MeleeAttack(this.gameObject));
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c5616b0c23c6dce40b9019a2217bc1a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -4,7 +4,11 @@ using UnityEngine;
using Assets.Scripts.Entities.Attack;
namespace Assets.Scripts.Entities {
class Enemy : Mob {
public class Enemy : Mob {
public enum Enemys {
SCORPION,
BUG
}
[SerializeField]
private float speed = 1;

View file

@ -23,7 +23,7 @@ public class Player : Mob {
void Update() {
if ( Time.timeSinceLevelLoad >= nextAttackTime && attack != null) {
if ( Input.GetKey(KeyCode.Space) ) {
if ( Input.GetAxis("Fire") > 0 ) {
Debug.Log("Attack pressed!");
attack.Attack();
nextAttackTime = Time.timeSinceLevelLoad + attack.GetCooldownTime();

View file

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using Assets.Scripts.Entities.Attack;
namespace Assets.Scripts.Entities
{
class Spider : Enemy
{
public Spider() : base(45)
{
}
private void Start()
{
SetAttack(new SingleShot(this.gameObject));
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bba8747a38e6f32488753602d0a3f3e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,11 +1,10 @@
using System.Collections;
using Assets.Scripts.Entities;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameController : MonoBehaviour {
private Room start;
private Room finish;
@ -13,6 +12,12 @@ public class GameController : MonoBehaviour {
WIN, DIED
}
// Enemy Prefabs
[Header("Enemys")]
[SerializeField]
GameObject scorpion;
[Space(10)]
// Generation Settings
[Header("Tile Prefabs")]
[SerializeField]
@ -67,6 +72,7 @@ public class GameController : MonoBehaviour {
GameObject RockLRD;
private Dictionary<GenerationProcessor.ExtendedTileType, GameObject> genPrefabs;
private Dictionary<Enemy.Enemys, GameObject> enemyPrefabs;
[Space(10)]
[Header("References")]
@ -97,32 +103,37 @@ public class GameController : MonoBehaviour {
// Use this for initialization
void Start () {
genPrefabs = new Dictionary<GenerationProcessor.ExtendedTileType, GameObject>();
genPrefabs.Add(GenerationProcessor.ExtendedTileType.BorderOuter, BorderOuter);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.BorderInner, BorderInner);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.BorderSingle, BorderSingle);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.Rock, Rock);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockL, RockL);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockU, RockU);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockR, RockR);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockD, RockD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLU, RockLU);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLR, RockLR);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLD, RockLD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLURD, RockLURD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockRD, RockRD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockUR, RockUR);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockUD, RockUD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLUD, RockLUD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLUR, RockLUR);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockURD, RockURD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.RockLRD, RockLRD);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground0, Ground0);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground1, Ground1);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground2, Ground2);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.Ground3, Ground3);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.DoorInner, DoorInner);
genPrefabs.Add(GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter);
genPrefabs = new Dictionary<GenerationProcessor.ExtendedTileType, GameObject> {
{ GenerationProcessor.ExtendedTileType.BorderOuter, BorderOuter },
{ GenerationProcessor.ExtendedTileType.BorderInner, BorderInner },
{ GenerationProcessor.ExtendedTileType.BorderSingle, BorderSingle },
{ GenerationProcessor.ExtendedTileType.Rock, Rock },
{ GenerationProcessor.ExtendedTileType.RockL, RockL },
{ GenerationProcessor.ExtendedTileType.RockU, RockU },
{ GenerationProcessor.ExtendedTileType.RockR, RockR },
{ GenerationProcessor.ExtendedTileType.RockD, RockD },
{ GenerationProcessor.ExtendedTileType.RockLU, RockLU },
{ GenerationProcessor.ExtendedTileType.RockLR, RockLR },
{ GenerationProcessor.ExtendedTileType.RockLD, RockLD },
{ GenerationProcessor.ExtendedTileType.RockLURD, RockLURD },
{ GenerationProcessor.ExtendedTileType.RockRD, RockRD },
{ GenerationProcessor.ExtendedTileType.RockUR, RockUR },
{ GenerationProcessor.ExtendedTileType.RockUD, RockUD },
{ GenerationProcessor.ExtendedTileType.RockLUD, RockLUD },
{ GenerationProcessor.ExtendedTileType.RockLUR, RockLUR },
{ GenerationProcessor.ExtendedTileType.RockURD, RockURD },
{ GenerationProcessor.ExtendedTileType.RockLRD, RockLRD },
{ GenerationProcessor.ExtendedTileType.Ground0, Ground0 },
{ GenerationProcessor.ExtendedTileType.Ground1, Ground1 },
{ GenerationProcessor.ExtendedTileType.Ground2, Ground2 },
{ GenerationProcessor.ExtendedTileType.Ground3, Ground3 },
{ GenerationProcessor.ExtendedTileType.DoorInner, DoorInner },
{ GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter }
};
enemyPrefabs = new Dictionary<Enemy.Enemys, GameObject> {
{ Enemy.Enemys.SCORPION, scorpion }
};
}
// Update is called once per frame
@ -178,6 +189,7 @@ public class GameController : MonoBehaviour {
doorRoot.name = "Doors";
doorRoot.transform.SetParent(goStart.transform);
start = goStart.AddComponent<Room>();
start.SetCenter(dg.start.GetCenter());
lt = lt.FindAll(x => x.tag == "door");
lt.ForEach(x => {
x.SetParent(doorRoot.transform);
@ -185,7 +197,7 @@ public class GameController : MonoBehaviour {
});
start.SetDoorsRootObject(doorRoot);
// WIP
// Spawnpoint
GameObject spawnpointRoot = new GameObject();
spawnpointRoot.name = "Spawnpoints";
spawnpointRoot.transform.SetParent(goStart.transform);
@ -196,6 +208,7 @@ public class GameController : MonoBehaviour {
start.SetSpawnPointsRootObject(spawnpointRoot);
start.Reload();
start.transform.SetParent(mapRoot.transform);
// Finish room
@ -207,6 +220,7 @@ public class GameController : MonoBehaviour {
doorRootf.transform.SetParent(goFinish.transform);
ltf = ltf.FindAll(x => x.tag == "door");
finish = goFinish.AddComponent<Room>();
finish.SetCenter(dg.end.GetCenter());
ltf.ForEach(x => {
x.SetParent(doorRootf.transform);
x.gameObject.GetComponent<Door>().SetParent(finish);
@ -219,18 +233,34 @@ public class GameController : MonoBehaviour {
foreach (GenRoom gr in dg.rooms) {
GameObject groom = gp.ProcessRoom(gr.tiles);
List<Transform> ltg = new List<Transform>(groom.GetComponentsInChildren<Transform>());
// Doors
GameObject doorRootg = new GameObject();
doorRootg.name = "Doors";
doorRootg.transform.SetParent(groom.transform);
Room grom = groom.AddComponent<Room>();
grom.SetCenter(gr.GetCenter());
ltg = ltg.FindAll(x => x.tag == "door");
ltg.ForEach(x => {
x.SetParent(doorRootg.transform);
x.gameObject.GetComponent<Door>().SetParent(grom);
});
// Spawnpoints
GameObject tSpawnpointRoot = new GameObject();
tSpawnpointRoot.name = "Spawnpoints";
tSpawnpointRoot.transform.SetParent(groom.transform);
tSpawnpointRoot.transform.position = new Vector3(gr.roomPosition.x, gr.roomPosition.y, 0);
foreach(Vector2Int v in gr.spawnpoints) {
GameObject tspawn = new GameObject();
tspawn.transform.SetParent(tSpawnpointRoot.transform);
tspawn.transform.position = new Vector3(v.x, v.y, 0); // is this the center or the top left corner of a block?
}
grom.SetSpawnPointsRootObject(tSpawnpointRoot);
grom.SetDoorsRootObject(doorRootg);
grom.Reload();
DungeonGenerator.GenerateObjective(grom);
groom.transform.SetParent(mapRoot.transform);
}
@ -242,6 +272,7 @@ public class GameController : MonoBehaviour {
}
private void Starting() {
StartObjective goal = new StartObjective(start, playerPrefab);
start.SetObjective(goal);
start.OnPlayerEnter(player);
@ -253,6 +284,7 @@ public class GameController : MonoBehaviour {
Debug.Log("No Player spawned!");
}
finish.SetObjective(new FinishObjective(finish));
cam.GetComponent<AudioControl>().LevelBgm();
}
private void Running() {
@ -265,13 +297,12 @@ public class GameController : MonoBehaviour {
if ( ui != null ) {
Debug.Log("show end UI");
if(endCause == EndedCause.DIED) {
cam.GetComponent<AudioControl>().SfxPlay(2);
cam.GetComponent<AudioControl>().GameOverBgm();
ui.GetComponent<UIController>().ShowGameOverUI();
} else if(endCause == EndedCause.WIN) {
//cam.GetComponent<AudioControl>().SfxPlay(2);
ui.GetComponent<UIController>().ShowWinUI();
}
} else {
Debug.Log("No UI specified");
}
@ -285,6 +316,10 @@ public class GameController : MonoBehaviour {
return ui.GetComponent<UIController>();
}
public Dictionary<Enemy.Enemys, GameObject> GetEnemyPrefabs() {
return enemyPrefabs;
}
public bool GameEnded() {
return state == GameState.ENDED;
}

View file

@ -1,4 +1,5 @@
using System;
using Assets.Scripts.Entities;
using System;
using System.Collections.Generic;
using UnityEngine;
@ -214,13 +215,13 @@ public class DungeonGenerator {
}
foreach ( GenRoom r in rooms )
makeRoomRelative(r);
makeRoomRelative(start);
makeRoomRelative(end);
makeRoomRelative(path);
MakeRoomRelative(r);
MakeRoomRelative(start);
MakeRoomRelative(end);
MakeRoomRelative(path);
}
public void makeRoomRelative(GenRoom room) {
public void MakeRoomRelative(GenRoom room) {
room.roomPosition = room.bounds.position;
foreach ( Vector2Int v in room.tiles.Keys ) {
v.Set(( v - room.roomPosition ).x, ( v - room.roomPosition ).y);
@ -439,4 +440,20 @@ public class DungeonGenerator {
}
}
}
public static void GenerateObjective(Room r) {
Dictionary<Enemy.Enemys, GameObject> enemyPrefabs = GameController.instance.GetEnemyPrefabs(); // TODO not so cool
// TODO add more types
Objective o;
// ENTITYOBJECTIVE ENEMYS:
List<GameObject> lg = new List<GameObject>();
//GameObject scorp = enemyPrefabs[Enemy.Enemys.SCORPION];
lg.Add(enemyPrefabs[Enemy.Enemys.SCORPION]);
EntityObjective eo = new EntityObjective(r, lg);
o = eo;
r.SetObjective(o);
}
}

View file

@ -19,6 +19,7 @@ public class GenRoom {
// All positions are in room space relative to the room's anchor
public Dictionary<Vector2Int, GenTile> tiles = new Dictionary<Vector2Int, GenTile>();
public HashSet<Vector2Int> spawnpoints = new HashSet<Vector2Int>();
public Objective objective = null;
public float Distance(GenRoom r) {
return Math.Abs(GetCenter().x - r.GetCenter().x) + Math.Abs(GetCenter().y - r.GetCenter().y);

View file

@ -1,4 +1,5 @@
using System.Collections;
using Assets.Scripts.Entities;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -26,13 +27,19 @@ public class EntityObjective : Objective {
public override void ActivateGoal(Player ply) {
if ( activated )
return;
activated = true;
base.ActivateGoal(ply);
foreach ( GameObject i in prefabList ) {
Debug.Log("[ROOMS] Spawning Entity...");
if(i == null || player == null) {
Debug.Log("[ROOMS] Failed.. Entity not set in GameController!");
return;
}
GameObject tempObject = GameObject.Instantiate(i);
List<Transform> spawnPointList = room.GetSpawnpoints();
tempObject.transform.position = spawnPointList[Random.Range(0, spawnPointList.Count)].position;
tempObject.GetComponent<Enemy>().SetVictim(player.gameObject);
tempObject.GetComponent<Enemy>().SetObjective(this);
entityList.Add(tempObject);
}

View file

@ -36,13 +36,13 @@ public class PlayerMovement : MonoBehaviour {
{ // Forward
Vector3 acc = transform.up * acceleration;
if (Input.GetKey(KeyCode.S))
if (Input.GetAxis("Vertical") < 0)
acc *= 0;
rb.AddForce(acc);
}
{// Drag
Vector3 drag = speedVec.normalized * speed * speed * friction * -1;
if (Input.GetKey(KeyCode.S)) {
if (Input.GetAxis("Vertical") < 0) {
drag *= brake;
drag *= speed;
}
@ -57,10 +57,10 @@ public class PlayerMovement : MonoBehaviour {
//Debug.Log(br);
Debug.DrawLine(transform.position, transform.position + br, Color.red, 0.01f, false);
}
if ( Input.GetKey(KeyCode.A) )
if ( Input.GetAxis("Horizontal") < 0 )
rb.MoveRotation(rb.rotation + turnSpeed);
//transform.Rotate(Vector3.forward * turnSpeed);
if ( Input.GetKey(KeyCode.D) )
if ( Input.GetAxis("Horizontal") > 0 )
rb.MoveRotation(rb.rotation - turnSpeed);
//transform.Rotate(Vector3.forward * -turnSpeed);
// Debug lines

View file

@ -8,6 +8,8 @@ public class Room : MonoBehaviour {
GROUND, WALL, DOOR, ROCK
}
Vector2Int center;
List<Door> doors;
List<Transform> spawnpoints;
@ -41,6 +43,23 @@ public class Room : MonoBehaviour {
Unlock();
}
/// <summary>
/// Center point in Generation phase.
/// </summary>
/// <param name="v"></param>
public void SetCenter(Vector2Int v) {
center = v;
}
/// <summary>
/// Returns the Center as global from the generation. TODO change this
/// Is available after Generation and after Start Phase.
/// </summary>
/// <returns></returns>
public Vector2Int GetCenter() {
return center;
}
/// <summary>
/// Reloads the spawnpoints and doors.
/// </summary>

View file

@ -25,7 +25,7 @@ public class UIController : MonoBehaviour
void Update() {
if (Input.GetKey(KeyCode.R) && GameController.instance.GameEnded()) {
if (Input.GetAxis("Reset") > 0 && GameController.instance.GameEnded()) {
LoadSceneByIndex(firstSceneIndex);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

View file

@ -0,0 +1,84 @@
fileFormatVersion: 2
guid: e0921bbee8b59b14aa2eec08d09da8a4
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 1a8d8bc173b67a34d8ad6da5a9124a07
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -71,6 +71,7 @@ AudioMixerSnapshotController:
m_SnapshotID: d3789ccdbdc046a448f1887d94c3f7f5
m_FloatValues:
25123d234de4ec84aafee1d0c380f3ad: 0.025578512
7e224658afaf14242ba3996793ac12a1: -7.436929
m_TransitionOverrides: {}
--- !u!243 &243067197919102372
AudioMixerGroupController:

BIN
Assets/sound/main(0.5).wav Normal file

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: c89601ee48d799943a756d1d15cd4954
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/sound/menuV1.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: a90787ea4a183c44699deb2babada64b
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -38,11 +38,11 @@ InputManager:
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Fire1
m_Name: Fire
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: left ctrl
positiveButton: space
altNegativeButton:
altPositiveButton: mouse 0
gravity: 1000
@ -293,3 +293,19 @@ InputManager:
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Reset
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: r
altNegativeButton:
altPositiveButton: return
gravity: 1000
dead: 0.001
sensitivity: 1000
snap: 0
invert: 0
type: 0
axis: 0
joyNum: 0