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
drift: 1
brake: 2
maxBrakeTime: 30
accelerationTime: 0
decelerationTime: 0
brakeTime: 0
lastFrame: 0
state: 0
changeTime: 0
--- !u!198 &198051526896437106
maxBrakeTime: 5
accelerationTime: 2.115
decelerationTime: 1.2346
--- !u!198 &198696209911726984
ParticleSystem:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}

View file

@ -152,7 +152,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3}
m_audioClip: {fileID: 8300000, guid: 2a0cc1bc613a80645b3c91ef12ed3f02, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
@ -713,7 +713,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: 55610acd4a5540d4db1fe1e3f4a55f4a, type: 3}
m_audioClip: {fileID: 8300000, guid: 4c1bf81eb5198e8478ab6e997feef50d, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
@ -837,6 +837,62 @@ Transform:
m_Father: {fileID: 734498092}
m_RootOrder: 1
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
GameObject:
m_ObjectHideFlags: 0
@ -962,7 +1018,6 @@ MonoBehaviour:
- {fileID: 2133072948}
- {fileID: 2012930731}
- {fileID: 2060531170}
- {fileID: 1908750963}
- {fileID: 1015503430}
- {fileID: 343165590}
--- !u!1001 &934296221
@ -1360,8 +1415,8 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743,
type: 2}
propertyPath: m_FontData.m_FontSize
value: 200
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114395085421692120, guid: 460d856ea4eb14cedb5fecde1fe6d743,
type: 2}

View file

@ -152,7 +152,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243359265566762914, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: a90787ea4a183c44699deb2babada64b, type: 3}
m_audioClip: {fileID: 8300000, guid: 2a0cc1bc613a80645b3c91ef12ed3f02, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
@ -652,7 +652,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 243356048287013750, guid: efb934a745665924d8c7dd46c0a117ae,
type: 2}
m_audioClip: {fileID: 8300000, guid: 55610acd4a5540d4db1fe1e3f4a55f4a, type: 3}
m_audioClip: {fileID: 8300000, guid: 4c1bf81eb5198e8478ab6e997feef50d, type: 3}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
@ -1635,6 +1635,8 @@ MonoBehaviour:
- {fileID: 114022018}
- {fileID: 272880427}
- {fileID: 2015154023}
- {fileID: 1671123313}
- {fileID: 390756940}
--- !u!1 &1039057777
GameObject:
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 };
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 bool menu;
// Use this for initialization
void Start()
{
maintheme.loop = true;
menutheme.loop = true;
gameovers.loop = true;
@ -67,6 +67,9 @@ public class AudioControl : MonoBehaviour
soundeffects[sound].Stop();
}
public void SfxStop(Sfx sound) {
SfxStop((int)sound);
}
public bool SfxPlaying(int sound)
{

View file

@ -23,7 +23,7 @@ public class BrakeBarController : MonoBehaviour {
}
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) {

View file

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

View file

@ -32,7 +32,10 @@ public abstract class Mob : Entity {
isDead = true;
Death();
} 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

@ -82,6 +82,9 @@ public class Player : Mob {
protected override void Death() {
Debug.Log("Player died...");
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);
}
}

View file

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

View file

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

View file

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

View file

@ -15,22 +15,24 @@ public class PlayerMovement : MonoBehaviour {
[SerializeField]
public float brake = 2f;
[SerializeField]
public float maxBrakeTime = 30f;
public float maxBrakeTime = 5f;
// The time of the acceleration/deceleration sounds in seconds
public double accelerationTime;
public double decelerationTime;
[SerializeField]
public float accelerationTime = 5;
[SerializeField]
public float decelerationTime = 5;
public float brakeTime;
public float lastFrame;
float brakeTime;
float lastFrame;
public enum SpeedState
{
SLOW, FASTER, FAST, SLOWER
}
public SpeedState state;
public double changeTime;
SpeedState state;
double changeTime;
Rigidbody2D rb;
@ -41,6 +43,7 @@ public class PlayerMovement : MonoBehaviour {
state = SpeedState.SLOW;
brakeTime = 0;
lastFrame = Time.time;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slowdriving);
}
void Update() {
@ -50,8 +53,12 @@ public class PlayerMovement : MonoBehaviour {
}
if ( !firstKeyPressed && Input.anyKey ) {
firstKeyPressed = true;
if (Input.GetAxis("Vertical") >= 0) {
state = SpeedState.FASTER;
changeTime = Time.time;
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving);
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster);
}
}
}
@ -63,44 +70,64 @@ public class PlayerMovement : MonoBehaviour {
float speed = speedVec.magnitude;
bool braking = Input.GetAxis("Vertical") < 0;
if (brakeTime > maxBrakeTime) {
if (braking && brakeTime >= maxBrakeTime) {
brakeTime = maxBrakeTime;
braking = false;
} else if (!braking) {
//brakeTime -= (Time.time - lastFrame) * 0.1f;
}
if (braking) {
brakeTime += Time.time - lastFrame;
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.driving);
switch (state) {
case SpeedState.FASTER:
if (Time.time - changeTime > accelerationTime)
{
changeTime = Time.time;
state = SpeedState.SLOWER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slower);
}
break;
case SpeedState.FAST:
changeTime = Time.time;
state = SpeedState.SLOWER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slower);
break;
case SpeedState.SLOWER:
if (Time.time - changeTime > decelerationTime)
{
state = SpeedState.SLOW;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.slowdriving);
}
break;
case SpeedState.SLOW:
break;
}
} else {
if (brakeTime < 0)
brakeTime = 0;
GameController.instance.GetAudioControl().SfxStop(AudioControl.Sfx.slowdriving);
switch (state)
{
case SpeedState.FASTER:
if (Time.time - changeTime > accelerationTime)
if (Time.time - changeTime > accelerationTime) {
state = SpeedState.FAST;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.driving);
}
break;
case SpeedState.FAST:
break;
case SpeedState.SLOWER:
if (Time.time - changeTime > decelerationTime)
if (Time.time - changeTime > decelerationTime) {
changeTime = Time.time;
state = SpeedState.FASTER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster);
}
break;
case SpeedState.SLOW:
changeTime = Time.time;
state = SpeedState.FASTER;
GameController.instance.GetAudioControl().SfxPlay(AudioControl.Sfx.faster);
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_SnapshotID: d3789ccdbdc046a448f1887d94c3f7f5
m_FloatValues:
aa6b64c186541834a990dc7d71ef0490: -9.833286
2531afd284b58274a93052c093565106: -9.960263
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: {}
--- !u!243 &243021022379401452
AudioMixerGroupController:

View file

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

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 55610acd4a5540d4db1fe1e3f4a55f4a
guid: 4c1bf81eb5198e8478ab6e997feef50d
AudioImporter:
externalObjects: {}
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: