Added patron spawner.
This commit is contained in:
parent
5aac6aa72a
commit
c0ee8ea5c3
5 changed files with 61 additions and 14 deletions
|
|
@ -27,7 +27,7 @@ Transform:
|
||||||
m_GameObject: {fileID: 100000}
|
m_GameObject: {fileID: 100000}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 3, y: .5, z: .5}
|
m_LocalScale: {x: 3.5, y: .5, z: .5}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
--- !u!23 &2300000
|
--- !u!23 &2300000
|
||||||
|
|
|
||||||
|
|
@ -511,7 +511,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 186161493}
|
m_GameObject: {fileID: 186161493}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: .889999986, z: 1}
|
m_LocalScale: {x: 1, y: .889999986, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
@ -629,7 +629,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 317209490}
|
m_GameObject: {fileID: 317209490}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: .889999986, z: 1}
|
m_LocalScale: {x: 1, y: .889999986, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
@ -886,7 +886,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 400339584}
|
m_GameObject: {fileID: 400339584}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: .889999986, z: 1}
|
m_LocalScale: {x: 1, y: .889999986, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
@ -1420,7 +1420,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 659898285}
|
m_GameObject: {fileID: 659898285}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: .827395439, y: 0, z: 0}
|
m_LocalPosition: {x: .827395439, y: 0, z: 0}
|
||||||
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
@ -1562,7 +1562,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 739477386}
|
m_GameObject: {fileID: 739477386}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: .827395439, y: 0, z: 0}
|
m_LocalPosition: {x: .827395439, y: 0, z: 0}
|
||||||
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
@ -2570,6 +2570,15 @@ MonoBehaviour:
|
||||||
swigs: 5
|
swigs: 5
|
||||||
swigText: {fileID: 493161367}
|
swigText: {fileID: 493161367}
|
||||||
scoreText: {fileID: 621151321}
|
scoreText: {fileID: 621151321}
|
||||||
|
patronCount: 10
|
||||||
|
spawnWait: .5
|
||||||
|
startWait: 1
|
||||||
|
waveWait: 1
|
||||||
|
patron:
|
||||||
|
- {fileID: 100002, guid: 90277a37311b8fc4bbb1fbb1544e7530, type: 2}
|
||||||
|
- {fileID: 100002, guid: e5c4c39c0dd99f94dbc695a71276c6eb, type: 2}
|
||||||
|
- {fileID: 100000, guid: 41b19f6c96ad15e4dace633fe1d0a962, type: 2}
|
||||||
|
- {fileID: 100000, guid: bccc8e6eeff34c1468a1024f0111109c, type: 2}
|
||||||
--- !u!4 &1164596950
|
--- !u!4 &1164596950
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
@ -3647,7 +3656,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1880321583}
|
m_GameObject: {fileID: 1880321583}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
@ -3920,7 +3929,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2009917412}
|
m_GameObject: {fileID: 2009917412}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: .850000024, z: 1}
|
m_LocalScale: {x: 1, y: .850000024, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
@ -4011,7 +4020,7 @@ Transform:
|
||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2107301824}
|
m_GameObject: {fileID: 2107301824}
|
||||||
m_LocalRotation: {x: .382683456, y: 0, z: 0, w: .923879504}
|
m_LocalRotation: {x: .382683486, y: 0, z: 0, w: .923879564}
|
||||||
m_LocalPosition: {x: .827395439, y: 0, z: 0}
|
m_LocalPosition: {x: .827395439, y: 0, z: 0}
|
||||||
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
m_LocalScale: {x: .939999998, y: .810000002, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,21 @@ public class GameController : MonoBehaviour {
|
||||||
public int swigs;
|
public int swigs;
|
||||||
public GUIText swigText;
|
public GUIText swigText;
|
||||||
public GUIText scoreText;
|
public GUIText scoreText;
|
||||||
|
public int patronCount;
|
||||||
|
public float spawnWait;
|
||||||
|
public float startWait;
|
||||||
|
public float waveWait;
|
||||||
|
public GameObject[] patron;
|
||||||
|
|
||||||
private int score = 0;
|
private int score = 0;
|
||||||
|
private int patrons = 0;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
UpdateSwigText ();
|
UpdateSwigText ();
|
||||||
UpdateScoreText ();
|
UpdateScoreText ();
|
||||||
|
|
||||||
|
StartCoroutine (SpawnWaves ());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
@ -20,6 +28,28 @@ public class GameController : MonoBehaviour {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEnumerator SpawnWaves ()
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds (startWait);
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (patrons < patronCount)
|
||||||
|
{
|
||||||
|
Vector3 spawnPosition = new Vector3 (40f, 2.5f, 10f);
|
||||||
|
Quaternion spawnRotation = Quaternion.identity;
|
||||||
|
|
||||||
|
GameObject patron = Instantiate (patron[Random.Range (0, patron.Length)], spawnPosition, spawnRotation);
|
||||||
|
|
||||||
|
patrons++;
|
||||||
|
|
||||||
|
yield return new WaitForSeconds (spawnWait);
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds (waveWait);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void TakeSwig() {
|
public void TakeSwig() {
|
||||||
swigs -= 1;
|
swigs -= 1;
|
||||||
UpdateSwigText();
|
UpdateSwigText();
|
||||||
|
|
|
||||||
|
|
@ -79,14 +79,22 @@ public class PlayerController : MonoBehaviour {
|
||||||
animator.SetBool("isWalkingUp", false);
|
animator.SetBool("isWalkingUp", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moveHorizontal < 0 && moveVertical > 0) // left up
|
if (moveHorizontal < 0 && moveVertical > 0) { // left up
|
||||||
playerAngle.eulerAngles = new Vector3(0f, -135, 0f);
|
playerAngle.eulerAngles = new Vector3(0f, -135, 0f);
|
||||||
else if (moveHorizontal < 0 && moveVertical < 0) // left down
|
MakePlayerSpriteFace(Direction.Left);
|
||||||
|
}
|
||||||
|
else if (moveHorizontal < 0 && moveVertical < 0) {// left down
|
||||||
playerAngle.eulerAngles = new Vector3(0f, -225f, 0f);
|
playerAngle.eulerAngles = new Vector3(0f, -225f, 0f);
|
||||||
else if (moveHorizontal > 0 && moveVertical > 0) //right up
|
MakePlayerSpriteFace(Direction.Left);
|
||||||
|
}
|
||||||
|
else if (moveHorizontal > 0 && moveVertical > 0) {//right up
|
||||||
playerAngle.eulerAngles = new Vector3(0f, -45f, 0f);
|
playerAngle.eulerAngles = new Vector3(0f, -45f, 0f);
|
||||||
else if (moveHorizontal > 0 && moveVertical < 0) //right down
|
MakePlayerSpriteFace(Direction.Right);
|
||||||
|
}
|
||||||
|
else if (moveHorizontal > 0 && moveVertical < 0) {//right down
|
||||||
playerAngle.eulerAngles = new Vector3(0f, 45f, 0f);
|
playerAngle.eulerAngles = new Vector3(0f, 45f, 0f);
|
||||||
|
MakePlayerSpriteFace(Direction.Right);
|
||||||
|
}
|
||||||
else if (moveHorizontal < 0) { // Stab left
|
else if (moveHorizontal < 0) { // Stab left
|
||||||
playerAngle.eulerAngles = new Vector3(0f, -180f, 0f);
|
playerAngle.eulerAngles = new Vector3(0f, -180f, 0f);
|
||||||
MakePlayerSpriteFace(Direction.Left);
|
MakePlayerSpriteFace(Direction.Left);
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ Material:
|
||||||
second:
|
second:
|
||||||
m_Texture: {fileID: 2800000, guid: 26c9dff0fed396341b045e42e3a0b500, type: 3}
|
m_Texture: {fileID: 2800000, guid: 26c9dff0fed396341b045e42e3a0b500, type: 3}
|
||||||
m_Scale: {x: 1, y: .5}
|
m_Scale: {x: 1, y: .5}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: .5}
|
||||||
data:
|
data:
|
||||||
first:
|
first:
|
||||||
name: _BumpMap
|
name: _BumpMap
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue