1
0
Fork 0

Merge remote-tracking branch 'origin/master'

This commit is contained in:
Triceraptodactyl 2018-04-24 01:02:39 +02:00
commit 6fb48d423d
21 changed files with 170 additions and 69 deletions

View file

@ -482,14 +482,10 @@ MonoBehaviour:
turnSpeed: 2 turnSpeed: 2
drift: 1 drift: 1
brake: 2 brake: 2
maxBrakeTime: 30 maxBrakeTime: 5
accelerationTime: 0 accelerationTime: 2.115
decelerationTime: 0 decelerationTime: 1.2346
brakeTime: 0 --- !u!198 &198696209911726984
lastFrame: 0
state: 0
changeTime: 0
--- !u!198 &198051526896437106
ParticleSystem: ParticleSystem:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}

View file

@ -152,7 +152,7 @@ AudioSource:
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae, OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2} type: 2}
m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3} m_audioClip: {fileID: 8300000, guid: 2a0cc1bc613a80645b3c91ef12ed3f02, type: 3}
m_PlayOnAwake: 0 m_PlayOnAwake: 0
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
@ -713,7 +713,7 @@ AudioSource:
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae, OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2} type: 2}
m_audioClip: {fileID: 8300000, guid: 55610acd4a5540d4db1fe1e3f4a55f4a, type: 3} m_audioClip: {fileID: 8300000, guid: 4c1bf81eb5198e8478ab6e997feef50d, type: 3}
m_PlayOnAwake: 0 m_PlayOnAwake: 0
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
@ -837,6 +837,62 @@ Transform:
m_Father: {fileID: 734498092} m_Father: {fileID: 734498092}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &865504979
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4079161515917916, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114874769993434856, guid: 3d1911457c1e44f53b6b4044334db52f,
type: 2}
propertyPath: decelerationTime
value: 1.2346
objectReference: {fileID: 0}
- target: {fileID: 114874769993434856, guid: 3d1911457c1e44f53b6b4044334db52f,
type: 2}
propertyPath: accelerationTime
value: 2.115
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 3d1911457c1e44f53b6b4044334db52f, type: 2}
m_IsPrefabParent: 0
--- !u!1 &881384367 --- !u!1 &881384367
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -962,7 +1018,6 @@ MonoBehaviour:
- {fileID: 2133072948} - {fileID: 2133072948}
- {fileID: 2012930731} - {fileID: 2012930731}
- {fileID: 2060531170} - {fileID: 2060531170}
- {fileID: 1908750963}
- {fileID: 1015503430} - {fileID: 1015503430}
- {fileID: 343165590} - {fileID: 343165590}
--- !u!1001 &934296221 --- !u!1001 &934296221
@ -1360,8 +1415,8 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743, - target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743,
type: 2} type: 2}
propertyPath: m_FontData.m_FontSize propertyPath: m_AnchoredPosition.x
value: 200 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743, - target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743,
type: 2} type: 2}

View file

@ -152,7 +152,7 @@ AudioSource:
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae, OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2} type: 2}
m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3} m_audioClip: {fileID: 8300000, guid: 2a0cc1bc613a80645b3c91ef12ed3f02, type: 3}
m_PlayOnAwake: 1 m_PlayOnAwake: 1
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
@ -652,7 +652,7 @@ AudioSource:
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae, OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2} type: 2}
m_audioClip: {fileID: 8300000, guid: 55610acd4a5540d4db1fe1e3f4a55f4a, type: 3} m_audioClip: {fileID: 8300000, guid: 4c1bf81eb5198e8478ab6e997feef50d, type: 3}
m_PlayOnAwake: 0 m_PlayOnAwake: 0
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
@ -1635,6 +1635,8 @@ MonoBehaviour:
- {fileID: 114022018} - {fileID: 114022018}
- {fileID: 272880427} - {fileID: 272880427}
- {fileID: 2015154023} - {fileID: 2015154023}
- {fileID: 1671123313}
- {fileID: 390756940}
--- !u!1 &1039057777 --- !u!1 &1039057777
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -14,13 +14,13 @@ public class AudioControl : MonoBehaviour
public enum Sfx { shoot, explosion, mobattack, door, faster, slower, driving, slowdriving, hitmob, hitplayer }; public enum Sfx { shoot, explosion, mobattack, door, faster, slower, driving, slowdriving, hitmob, hitplayer };
private const float lvlbgm = 5.725f; private const float lvlbgm = 5.725f;
private const float gobgm = 14.406f; private const float gobgm = 14.157f;
private const float loopdelay = 0.025f; private const float loopdelay = 0.025f;
private bool menu;
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
maintheme.loop = true; maintheme.loop = true;
menutheme.loop = true; menutheme.loop = true;
gameovers.loop = true; gameovers.loop = true;
@ -67,12 +67,15 @@ public class AudioControl : MonoBehaviour
soundeffects[sound].Stop(); soundeffects[sound].Stop();
} }
public void SfxStop(Sfx sound) {
SfxStop((int)sound);
}
public bool SfxPlaying(int sound) public bool SfxPlaying(int sound)
{ {
return soundeffects[sound].isPlaying; return soundeffects[sound].isPlaying;
} }
public void SetMasterVolume(float nvol) public void SetMasterVolume(float nvol)
{ {
mixer.SetFloat("masterVolume", Mathf.Clamp(nvol, -80f, 20f)); mixer.SetFloat("masterVolume", Mathf.Clamp(nvol, -80f, 20f));

View file

@ -23,7 +23,7 @@ public class BrakeBarController : MonoBehaviour {
} }
private float CalculateOffset() { private float CalculateOffset() {
return (maxRotation * (player.GetComponent<PlayerMovement>().brakeTime / player.GetComponent<PlayerMovement>().maxBrakeTime)) - currentRotation; return (maxRotation * (player.GetComponent<PlayerMovement>().GetBrakeTime() / player.GetComponent<PlayerMovement>().maxBrakeTime)) - currentRotation;
} }
public void SetPlayer(Player ply) { public void SetPlayer(Player ply) {

View file

@ -42,7 +42,10 @@ namespace Assets.Scripts.Entities.Attack {
bu.SetSpeed(speed); bu.SetSpeed(speed);
bu.SetOwner(owner); bu.SetOwner(owner);
bu.StartBullet(); bu.StartBullet();
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.shoot); if (owner.name.Contains("Player"))
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.shoot);
else
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.mobattack);
} }
public float GetCooldownTime() { public float GetCooldownTime() {

View file

@ -32,7 +32,10 @@ public abstract class Mob : Entity {
isDead = true; isDead = true;
Death(); Death();
} else if (! isDead) { } else if (! isDead) {
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.mobattack); if (this is Player)
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.hitplayer);
else
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.hitmob);
} }
} }

View file

@ -81,7 +81,10 @@ public class Player : Mob {
/// </summary> /// </summary>
protected override void Death() { protected override void Death() {
Debug.Log("Player died..."); Debug.Log("Player died...");
Destroy(this.gameObject); Destroy(this.gameObject);
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving);
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.driving);
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.explosion);
GameController.instance.EndGame(GameController.EndedCause.DIED); GameController.instance.EndGame(GameController.EndedCause.DIED);
} }
} }

View file

@ -433,7 +433,7 @@ public class DungeonGenerator {
r.tiles[pos].type = Room.TileType.ROCK; r.tiles[pos].type = Room.TileType.ROCK;
continue; continue;
} }
float prob2 = 0.04f; float prob2 = 0.004f;
if (UnityEngine.Random.value > 1 - prob2) if (UnityEngine.Random.value > 1 - prob2)
{ {
r.spawnpoints.Add(pos); r.spawnpoints.Add(pos);

View file

@ -14,7 +14,7 @@ public class HealthbarController : MonoBehaviour {
// if player alive and spawned // if player alive and spawned
if (player != null) if (player != null)
{ {
Debug.Log(player.GetHealth()); //Debug.Log(player.GetHealth());
UpdatePointer(player.GetHealth()); UpdatePointer(player.GetHealth());
} }
else else
@ -32,7 +32,7 @@ public class HealthbarController : MonoBehaviour {
offset = 0; offset = 0;
Debug.Log("Player not found"); Debug.Log("Player not found");
} else { } else {
Debug.Log("calculated offset"); //Debug.Log("calculated offset");
offset = ((playerLife / maxRotation) * 100) - currentRotation; offset = ((playerLife / maxRotation) * 100) - currentRotation;
} }

View file

@ -28,6 +28,13 @@ public class EntityObjective : Objective {
if ( activated ) if ( activated )
return; return;
base.ActivateGoal(ply); base.ActivateGoal(ply);
List<Transform> spawnPointList = room.GetSpawnpoints();
if (spawnPointList.Count == 0) {
ReachedGoal();
return;
}
foreach ( GameObject i in prefabList ) { foreach ( GameObject i in prefabList ) {
Debug.Log("[ROOMS] Spawning Entity..."); Debug.Log("[ROOMS] Spawning Entity...");
if(i == null || player == null) { if(i == null || player == null) {
@ -35,8 +42,7 @@ public class EntityObjective : Objective {
return; return;
} }
GameObject tempObject = GameObject.Instantiate(i); GameObject tempObject = UnityEngine.Object.Instantiate(i);
List<Transform> spawnPointList = room.GetSpawnpoints();
tempObject.transform.position = spawnPointList[Random.Range(0, spawnPointList.Count)].position; tempObject.transform.position = spawnPointList[Random.Range(0, spawnPointList.Count)].position;
tempObject.GetComponent<Entity>().SetObjective(this); tempObject.GetComponent<Entity>().SetObjective(this);
entityList.Add(tempObject); entityList.Add(tempObject);

View file

@ -15,22 +15,24 @@ public class PlayerMovement : MonoBehaviour {
[SerializeField] [SerializeField]
public float brake = 2f; public float brake = 2f;
[SerializeField] [SerializeField]
public float maxBrakeTime = 30f; public float maxBrakeTime = 5f;
// The time of the acceleration/deceleration sounds in seconds // The time of the acceleration/deceleration sounds in seconds
public double accelerationTime; [SerializeField]
public double decelerationTime; public float accelerationTime = 5;
[SerializeField]
public float decelerationTime = 5;
public float brakeTime; float brakeTime;
public float lastFrame; float lastFrame;
public enum SpeedState public enum SpeedState
{ {
SLOW, FASTER, FAST, SLOWER SLOW, FASTER, FAST, SLOWER
} }
public SpeedState state; SpeedState state;
public double changeTime; double changeTime;
Rigidbody2D rb; Rigidbody2D rb;
@ -41,6 +43,7 @@ public class PlayerMovement : MonoBehaviour {
state = SpeedState.SLOW; state = SpeedState.SLOW;
brakeTime = 0; brakeTime = 0;
lastFrame = Time.time; lastFrame = Time.time;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slowdriving);
} }
void Update() { void Update() {
@ -50,8 +53,12 @@ public class PlayerMovement : MonoBehaviour {
} }
if ( !firstKeyPressed && Input.anyKey ) { if ( !firstKeyPressed && Input.anyKey ) {
firstKeyPressed = true; firstKeyPressed = true;
state = SpeedState.FASTER; if (Input.GetAxis("Vertical") >= 0) {
changeTime = Time.time; state = SpeedState.FASTER;
changeTime = Time.time;
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving);
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster);
}
} }
} }
@ -61,46 +68,66 @@ public class PlayerMovement : MonoBehaviour {
Vector3 speedVec = new Vector3(rb.velocity.x, rb.velocity.y, 0); Vector3 speedVec = new Vector3(rb.velocity.x, rb.velocity.y, 0);
float speed = speedVec.magnitude; float speed = speedVec.magnitude;
bool braking = Input.GetAxis("Vertical") < 0; bool braking = Input.GetAxis("Vertical") < 0;
if (brakeTime > maxBrakeTime) { if (braking && brakeTime >= maxBrakeTime) {
brakeTime = maxBrakeTime; brakeTime = maxBrakeTime;
braking = false; braking = false;
} else if (!braking) {
//brakeTime -= (Time.time - lastFrame) * 0.1f;
} }
if (braking) { if (braking) {
brakeTime += Time.time - lastFrame; brakeTime += Time.time - lastFrame;
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.driving);
switch (state) { switch (state) {
case SpeedState.FASTER: case SpeedState.FASTER:
if (Time.time - changeTime > accelerationTime) if (Time.time - changeTime > accelerationTime)
state = SpeedState.SLOWER; {
changeTime = Time.time;
state = SpeedState.SLOWER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slower);
}
break; break;
case SpeedState.FAST: case SpeedState.FAST:
changeTime = Time.time; changeTime = Time.time;
state = SpeedState.SLOWER; state = SpeedState.SLOWER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slower);
break; break;
case SpeedState.SLOWER: case SpeedState.SLOWER:
if (Time.time - changeTime > decelerationTime) if (Time.time - changeTime > decelerationTime)
{
state = SpeedState.SLOW; state = SpeedState.SLOW;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slowdriving);
}
break; break;
case SpeedState.SLOW: case SpeedState.SLOW:
break; break;
} }
} else { } else {
if (brakeTime < 0)
brakeTime = 0;
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving);
switch (state) switch (state)
{ {
case SpeedState.FASTER: case SpeedState.FASTER:
if (Time.time - changeTime > accelerationTime) if (Time.time - changeTime > accelerationTime) {
state = SpeedState.FAST; state = SpeedState.FAST;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.driving);
}
break; break;
case SpeedState.FAST: case SpeedState.FAST:
break; break;
case SpeedState.SLOWER: case SpeedState.SLOWER:
if (Time.time - changeTime > decelerationTime) if (Time.time - changeTime > decelerationTime) {
state = SpeedState.FASTER; changeTime = Time.time;
state = SpeedState.FASTER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster);
}
break; break;
case SpeedState.SLOW: case SpeedState.SLOW:
changeTime = Time.time; changeTime = Time.time;
state = SpeedState.FASTER; state = SpeedState.FASTER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster);
break; break;
} }
} }

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9ec323b9157704d00a3409f8ea6e46b2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: df6e7833427b5497b92308fb6f54e552
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -77,8 +77,17 @@ AudioMixerSnapshotController:
m_AudioMixer: {fileID: 24100000} m_AudioMixer: {fileID: 24100000}
m_SnapshotID: d3789ccdbdc046a448f1887d94c3f7f5 m_SnapshotID: d3789ccdbdc046a448f1887d94c3f7f5
m_FloatValues: m_FloatValues:
aa6b64c186541834a990dc7d71ef0490: -9.833286
2531afd284b58274a93052c093565106: -9.960263
25123d234de4ec84aafee1d0c380f3ad: 0.025578512 25123d234de4ec84aafee1d0c380f3ad: 0.025578512
7e224658afaf14242ba3996793ac12a1: -0.025776558 af748c25161478f4c933cb5cf60cf925: -4.560346
8b04b72683f112d418bf818b2395ba51: -9.833286
ce741f86488e78548ad32eec9ad31803: -13.0627575
3085c47799436ad43a18d4ae4adb712d: -9.833286
7e224658afaf14242ba3996793ac12a1: -0.02577656
644f6589fc60a074a98ad67d609f2bfb: 5.1526957
5da050aa578318a4f8f1fed71a509fce: -14.816608
bf89843b5f1f52248935471e56d764be: -9.833286
m_TransitionOverrides: {} m_TransitionOverrides: {}
--- !u!243 &243021022379401452 --- !u!243 &243021022379401452
AudioMixerGroupController: AudioMixerGroupController:

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a90787ea4a183c44699deb2babada64b guid: 2a0cc1bc613a80645b3c91ef12ed3f02
AudioImporter: AudioImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 6 serializedVersion: 6

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 55610acd4a5540d4db1fe1e3f4a55f4a guid: 4c1bf81eb5198e8478ab6e997feef50d
AudioImporter: AudioImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 6 serializedVersion: 6

Binary file not shown.

View file

@ -1,22 +0,0 @@
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: