diff --git a/Assets/Prefabs/Bullet.prefab b/Assets/Prefabs/Bullet.prefab index b864e1f..fef4234 100644 --- a/Assets/Prefabs/Bullet.prefab +++ b/Assets/Prefabs/Bullet.prefab @@ -38,7 +38,7 @@ Transform: m_GameObject: {fileID: 1379543051791382} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: -0.625, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalScale: {x: 2, y: 2, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -101,6 +101,7 @@ MonoBehaviour: m_EditorClassIdentifier: speed: 10 damage: 0 + start: 0 --- !u!212 &212185122411066660 SpriteRenderer: m_ObjectHideFlags: 1 diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index ca20c9b..082c5f3 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -482,7 +482,7 @@ MonoBehaviour: turnSpeed: 2 drift: 1 brake: 2 - maxBrakeTime: 30 + maxBrakeTime: 15 accelerationTime: 2.115 decelerationTime: 1.2346 --- !u!198 &198306026557504490 diff --git a/Assets/Scripts/Entities/Attack/SingleShot.cs b/Assets/Scripts/Entities/Attack/SingleShot.cs index 70c8805..dbf1129 100644 --- a/Assets/Scripts/Entities/Attack/SingleShot.cs +++ b/Assets/Scripts/Entities/Attack/SingleShot.cs @@ -13,9 +13,18 @@ namespace Assets.Scripts.Entities.Attack { GameObject bulletPrefab; Transform spawn; - public SingleShot(GameObject owner) { + public SingleShot(GameObject owner) + { this.owner = owner; - } + } + + public SingleShot(GameObject owner, int damage, float cooldown, float speed) + { + this.owner = owner; + this.damage = damage; + this.cooldown = cooldown; + this.speed = speed; + } public void SetCooldown(float cd) { cooldown = cd; diff --git a/Assets/Scripts/Entities/Player.cs b/Assets/Scripts/Entities/Player.cs index 2e87157..1baa1ab 100644 --- a/Assets/Scripts/Entities/Player.cs +++ b/Assets/Scripts/Entities/Player.cs @@ -12,37 +12,19 @@ public class Player : Mob { //[SerializeField] //private int carDamage = 5; - private SingleShot singleShot; - private GatlingGun ggun; - private float nextAttackTime; public Player() : base(100) { } private void Start() { - SingleShot s = new SingleShot(this.gameObject); + SingleShot s = new SingleShot(this.gameObject, 6, 0.2f, 20); s.SetPrefab(bulletPrefab); s.SetSpawn(bulletSpawn); - singleShot = s; - GatlingGun g = new GatlingGun(this.gameObject); - g.SetPrefab(bulletPrefab); - g.SetSpawn(bulletSpawn); - ggun = g; body = GetComponent(); SetAttack(s); } void Update() { - if(Input.GetKeyDown(KeyCode.G)) { - if(attack != ggun) { - attack = ggun; - Debug.Log("Switched to GatlingGun"); - } else { - attack = singleShot; - Debug.Log("Switched to SingleShot"); - } - - } if ( Time.timeSinceLevelLoad >= nextAttackTime && attack != null) { if ( Input.GetAxis("Fire") > 0 ) { attack.Attack(); @@ -66,7 +48,8 @@ public class Player : Mob { private void OnCollisionEnter2D(Collision2D collision) { Debug.Log("Collision"); if ( collision.collider.tag == "wall" ) { - Death(); + //InflictDamage(maxHP / 2); + Death(); } else if ( collision.collider.tag == "Enemy" ) { Mob m = collision.collider.GetComponent(typeof(Mob)) as Mob; if ( m != null ) { diff --git a/Assets/Scripts/Generation/DungeonGenerator.cs b/Assets/Scripts/Generation/DungeonGenerator.cs index d91efd3..8abf092 100644 --- a/Assets/Scripts/Generation/DungeonGenerator.cs +++ b/Assets/Scripts/Generation/DungeonGenerator.cs @@ -433,7 +433,7 @@ public class DungeonGenerator { r.tiles[pos].type = Room.TileType.ROCK; continue; } - float prob2 = 0.004f; + float prob2 = 0.04f; if (UnityEngine.Random.value > 1 - prob2) { r.spawnpoints.Add(pos); diff --git a/Assets/Scripts/Objectives/EntityObjective.cs b/Assets/Scripts/Objectives/EntityObjective.cs index 3f5eb66..b29aa0a 100644 --- a/Assets/Scripts/Objectives/EntityObjective.cs +++ b/Assets/Scripts/Objectives/EntityObjective.cs @@ -30,8 +30,8 @@ public class EntityObjective : Objective { base.ActivateGoal(ply); List spawnPointList = room.GetSpawnpoints(); - if (spawnPointList.Count == 0) { - ReachedGoal(); + if (spawnPointList.Count == 0) { + finished = true; return; } @@ -43,7 +43,7 @@ public class EntityObjective : Objective { } GameObject tempObject = UnityEngine.Object.Instantiate(i); - tempObject.transform.position = spawnPointList[Random.Range(0, spawnPointList.Count)].position; + tempObject.transform.position = spawnPointList[Random.Range(0, spawnPointList.Count)].position; tempObject.GetComponent().SetObjective(this); entityList.Add(tempObject); } diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index c51e374..875673c 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -53,8 +53,9 @@ public class PlayerMovement : MonoBehaviour { } if ( !firstKeyPressed && Input.anyKey ) { firstKeyPressed = true; - if (Input.GetAxis("Vertical") >= 0) { - state = SpeedState.FASTER; + lastFrame = Time.time; + 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); diff --git a/Assets/Scripts/Room.cs b/Assets/Scripts/Room.cs index d3382ac..2dd6a95 100644 --- a/Assets/Scripts/Room.cs +++ b/Assets/Scripts/Room.cs @@ -77,6 +77,8 @@ public class Room : MonoBehaviour { foreach ( Transform t in spawnpointRootObject.GetComponentsInChildren() ) { if ( t.gameObject != spawnpointRootObject ) { spawnpoints.Add(t); + if (spawnpoints.Count >= 5) + break; // TODO make this depend on the objective } } //Debug.Log("[ROOMS] Spawnpoints: " + spawnpoints.Count);