1
0
Fork 0

Auto stash before merge of "PiegamesDev" and "origin/master"

This commit is contained in:
Piegames 2018-04-24 01:53:28 +02:00
parent 68a967a6bc
commit db1b7045ec
8 changed files with 26 additions and 30 deletions

View file

@ -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

View file

@ -482,7 +482,7 @@ MonoBehaviour:
turnSpeed: 2
drift: 1
brake: 2
maxBrakeTime: 30
maxBrakeTime: 15
accelerationTime: 2.115
decelerationTime: 1.2346
--- !u!198 &198306026557504490

View file

@ -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;

View file

@ -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<Rigidbody2D>();
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 ) {

View file

@ -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);

View file

@ -30,8 +30,8 @@ public class EntityObjective : Objective {
base.ActivateGoal(ply);
List<Transform> 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<Entity>().SetObjective(this);
entityList.Add(tempObject);
}

View file

@ -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);

View file

@ -77,6 +77,8 @@ public class Room : MonoBehaviour {
foreach ( Transform t in spawnpointRootObject.GetComponentsInChildren<Transform>() ) {
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);