Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
enemyy 2 still doesn't die
  • Loading branch information
smz11006 committed Nov 10, 2015
1 parent 1d0e265 commit 399042d
Show file tree
Hide file tree
Showing 24 changed files with 115 additions and 18 deletions.
Binary file modified ShipShooter/Assets/Enemies/-Enemy2-RigidBody.prefab
Binary file not shown.
Binary file modified ShipShooter/Assets/Enemies/Enemy2Bullet.prefab
Binary file not shown.
Binary file modified ShipShooter/Assets/Scenes/GameScene.unity
Binary file not shown.
2 changes: 1 addition & 1 deletion ShipShooter/Assets/Scripts/BackgroundScroll.cs
Expand Up @@ -5,6 +5,6 @@ public class BackgroundScroll : MonoBehaviour {


void Start () void Start ()
{ {
iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPath("BackgroundTrack"), "time", 30, "transition", "easeinSine")); iTween.MoveTo(gameObject, iTween.Hash("path", iTweenPath.GetPath("BackgroundTrack"), "time", 60));
} }
} }
2 changes: 1 addition & 1 deletion ShipShooter/Assets/Scripts/Enemy1.cs
Expand Up @@ -31,7 +31,7 @@ public class Enemy1 : MonoBehaviour {
testInt = Mathf.RoundToInt(test); testInt = Mathf.RoundToInt(test);
//shooting--------------------------------------------------------------------------------- //shooting---------------------------------------------------------------------------------
posCanon = new Vector3(turret.transform.position.x, turret.transform.position.y - 0.5f, turret.transform.position.z); posCanon = new Vector3(turret.transform.position.x, turret.transform.position.y - 0.5f, turret.transform.position.z);
if (testInt % 2 == 0) if (testInt % 4 == 0)
{ {
newBullet = (GameObject)Instantiate(bullet, posCanon, transform.rotation); newBullet = (GameObject)Instantiate(bullet, posCanon, transform.rotation);
iTween.MoveTo(newBullet, new Vector3(newBullet.transform.position.x, newBullet.transform.position.y - 40, 5), 1); iTween.MoveTo(newBullet, new Vector3(newBullet.transform.position.x, newBullet.transform.position.y - 40, 5), 1);
Expand Down
27 changes: 23 additions & 4 deletions ShipShooter/Assets/Scripts/Enemy2.cs
Expand Up @@ -13,23 +13,42 @@ public class Enemy2 : MonoBehaviour {
public GameObject turret; public GameObject turret;
public GameObject bullet; public GameObject bullet;
public Vector3 posCanon; public Vector3 posCanon;


public float test;
public int testInt;
public GameObject newBullet;

public Vector3 playerPos;
public GameObject player;

void OnCollisionEnter(Collision collision) void OnCollisionEnter(Collision collision)
{ {
if (collision.gameObject.tag == "Bullet") if (collision.gameObject.tag == "Bullet")
{ {
Destroy(gameObject);


health = health - 1;
} }
} }


void Update() void Update()
{ {


playerPos = new Vector3(player.transform.position.x, player.transform.position.y - 30, player.transform.position.z);

//Shooting =================================================== //Shooting ===================================================
posCanon = new Vector3(turret.transform.position.x, turret.transform.position.y - 0.5f, turret.transform.position.z); posCanon = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y - 0.5f, gameObject.transform.position.z);
test = gameObject.transform.position.y;
testInt = Mathf.RoundToInt(test);
//shooting---------------------------------------------------------------------------------
if (testInt % 4 == 0)
{
newBullet = (GameObject)Instantiate(bullet, posCanon, transform.rotation);
iTween.MoveTo(newBullet, playerPos, 1);


}


//Health----------------------------------------------------------------------------------- //Health-----------------------------------------------------------------------------------
if (health == 0) if (health == 0)
Destroy(gameObject); Destroy(gameObject);
if (health == 1) if (health == 1)
Expand Down
44 changes: 37 additions & 7 deletions ShipShooter/Assets/Scripts/EnemySpawner.cs
Expand Up @@ -56,15 +56,15 @@ public class EnemySpawner : MonoBehaviour {
public void EdgeSpawn() public void EdgeSpawn()
{ {
enemy1_left1 = (GameObject)Instantiate(enemy1, spawn1, Quaternion.Euler(enemyAngle)); enemy1_left1 = (GameObject)Instantiate(enemy1, spawn1, Quaternion.Euler(enemyAngle));
enemy1_right1 = (GameObject)Instantiate(enemy1, spawn1, Quaternion.Euler(enemyAngle)); enemy1_right1 = (GameObject)Instantiate(enemy1, spawn12, Quaternion.Euler(enemyAngle));
iTween.MoveTo(enemy1_left1, iTween.Hash("path", iTweenPath.GetPath("LeftCurve1"), "time", 10)); iTween.MoveTo(enemy1_left1, iTween.Hash("path", iTweenPath.GetPath("LeftCurve1"), "time", 10));
iTween.MoveTo(enemy1_right1, iTween.Hash("path", iTweenPath.GetPath("RightCurve1"), "time", 10)); iTween.MoveTo(enemy1_right1, iTween.Hash("path", iTweenPath.GetPath("RightCurve1"), "time", 10));


} }
public void EdgeSpawnIn() public void EdgeSpawnIn()
{ {
enemy1_left2 = (GameObject)Instantiate(enemy1, spawn2, Quaternion.Euler(enemyAngle)); enemy1_left2 = (GameObject)Instantiate(enemy1, spawn2, Quaternion.Euler(enemyAngle));
enemy1_right2 = (GameObject)Instantiate(enemy1, spawn2, Quaternion.Euler(enemyAngle)); enemy1_right2 = (GameObject)Instantiate(enemy1, spawn11, Quaternion.Euler(enemyAngle));


iTween.MoveTo(enemy1_left2, iTween.Hash("path", iTweenPath.GetPath("LeftCurve2"), "time", 10)); iTween.MoveTo(enemy1_left2, iTween.Hash("path", iTweenPath.GetPath("LeftCurve2"), "time", 10));
iTween.MoveTo(enemy1_right2, iTween.Hash("path", iTweenPath.GetPath("RightCurve2"), "time", 10)); iTween.MoveTo(enemy1_right2, iTween.Hash("path", iTweenPath.GetPath("RightCurve2"), "time", 10));
Expand All @@ -74,13 +74,30 @@ public class EnemySpawner : MonoBehaviour {
public void EdgeSpawnLast() public void EdgeSpawnLast()
{ {
enemy1_left3 = (GameObject)Instantiate(enemy1, spawn3, Quaternion.Euler(enemyAngle)); enemy1_left3 = (GameObject)Instantiate(enemy1, spawn3, Quaternion.Euler(enemyAngle));
enemy1_right3 = (GameObject)Instantiate(enemy1, spawn3, Quaternion.Euler(enemyAngle)); enemy1_right3 = (GameObject)Instantiate(enemy1, spawn10, Quaternion.Euler(enemyAngle));


iTween.MoveTo(enemy1_left3, iTween.Hash("path", iTweenPath.GetPath("LeftCurve3"), "time", 10)); iTween.MoveTo(enemy1_left3, iTween.Hash("path", iTweenPath.GetPath("LeftCurve3"), "time", 10));
iTween.MoveTo(enemy1_right3, iTween.Hash("path", iTweenPath.GetPath("RightCurve3"), "time", 10)); iTween.MoveTo(enemy1_right3, iTween.Hash("path", iTweenPath.GetPath("RightCurve3"), "time", 10));


} }


public void MidSpawnEdges()
{
enemy1_left1 = (GameObject)Instantiate(enemy2, spawn4, Quaternion.Euler(enemyAngle));
enemy1_right1 = (GameObject)Instantiate(enemy2, spawn9, Quaternion.Euler(enemyAngle));

iTween.MoveTo(enemy1_left1, iTween.Hash("path", iTweenPath.GetPath("CrossPath Mid-Left 1"), "time", 10));
iTween.MoveTo(enemy1_right1, iTween.Hash("path", iTweenPath.GetPath("CrossPath Mid-Right 1"), "time", 10));
}
public void MidSpawnMids()
{
enemy1_left1 = (GameObject)Instantiate(enemy2, spawn5, Quaternion.Euler(enemyAngle));
enemy1_right1 = (GameObject)Instantiate(enemy2, spawn8, Quaternion.Euler(enemyAngle));

iTween.MoveTo(enemy1_left1, iTween.Hash("path", iTweenPath.GetPath("CrossPath Mid-Left 2"), "time", 10));
iTween.MoveTo(enemy1_right1, iTween.Hash("path", iTweenPath.GetPath("CrossPath Mid-Right 2"), "time", 10));
}

//IEnumerator //IEnumerator
IEnumerator EnemySpawn() IEnumerator EnemySpawn()
{ {
Expand All @@ -91,7 +108,7 @@ public class EnemySpawner : MonoBehaviour {
Debug.Log("Enumerator Starts"); Debug.Log("Enumerator Starts");
enemy1count = 1; enemy1count = 1;
enemy1_left1 = (GameObject)Instantiate(enemy1, spawn1, Quaternion.Euler(enemyAngle)); enemy1_left1 = (GameObject)Instantiate(enemy1, spawn1, Quaternion.Euler(enemyAngle));
enemy1_right1 = (GameObject)Instantiate(enemy1, spawn1, Quaternion.Euler(enemyAngle)); enemy1_right1 = (GameObject)Instantiate(enemy1, spawn12, Quaternion.Euler(enemyAngle));


iTween.MoveTo(enemy1_left1, iTween.Hash("path", iTweenPath.GetPath("LeftCurve1"), "time", 10)); iTween.MoveTo(enemy1_left1, iTween.Hash("path", iTweenPath.GetPath("LeftCurve1"), "time", 10));
iTween.MoveTo(enemy1_right1, iTween.Hash("path", iTweenPath.GetPath("RightCurve1"), "time", 10)); iTween.MoveTo(enemy1_right1, iTween.Hash("path", iTweenPath.GetPath("RightCurve1"), "time", 10));
Expand All @@ -100,7 +117,7 @@ public class EnemySpawner : MonoBehaviour {


yield return new WaitForSeconds(0.2f); yield return new WaitForSeconds(0.2f);
enemy1_left2 = (GameObject)Instantiate(enemy1, spawn2, Quaternion.Euler(enemyAngle)); enemy1_left2 = (GameObject)Instantiate(enemy1, spawn2, Quaternion.Euler(enemyAngle));
enemy1_right2 = (GameObject)Instantiate(enemy1, spawn2, Quaternion.Euler(enemyAngle)); enemy1_right2 = (GameObject)Instantiate(enemy1, spawn11, Quaternion.Euler(enemyAngle));


iTween.MoveTo(enemy1_left2, iTween.Hash("path", iTweenPath.GetPath("LeftCurve2"), "time", 10)); iTween.MoveTo(enemy1_left2, iTween.Hash("path", iTweenPath.GetPath("LeftCurve2"), "time", 10));
iTween.MoveTo(enemy1_right2, iTween.Hash("path", iTweenPath.GetPath("RightCurve2"), "time", 10)); iTween.MoveTo(enemy1_right2, iTween.Hash("path", iTweenPath.GetPath("RightCurve2"), "time", 10));
Expand All @@ -113,9 +130,22 @@ public class EnemySpawner : MonoBehaviour {
iTween.MoveTo(enemy1_left3, iTween.Hash("path", iTweenPath.GetPath("LeftCurve3"), "time", 10)); iTween.MoveTo(enemy1_left3, iTween.Hash("path", iTweenPath.GetPath("LeftCurve3"), "time", 10));
iTween.MoveTo(enemy1_right3, iTween.Hash("path", iTweenPath.GetPath("RightCurve3"), "time", 10)); iTween.MoveTo(enemy1_right3, iTween.Hash("path", iTweenPath.GetPath("RightCurve3"), "time", 10));
// EdgeSpawnLast(); // EdgeSpawnLast();

yield return new WaitForSeconds(2f);
MidSpawnEdges();

yield return new WaitForSeconds(2f);
MidSpawnMids();
yield return new WaitForSeconds(2f);

EdgeSpawn();
MidSpawnEdges();
yield return new WaitForSeconds(2f);



Debug.Log("enumerator Ends"); Debug.Log("enumerator Ends");
//randomNum = Random.Range(1, 3);
//enemy1count = 0;
} }


} }
Expand Down
11 changes: 11 additions & 0 deletions ShipShooter/Assets/Scripts/Legosteroid.cs
@@ -0,0 +1,11 @@
using UnityEngine;
using System.Collections;

public class Legosteroid : MonoBehaviour {

public gameObject legosteroid;
public gameObject piece1;
public gameObject piece2;
public gameObject piece3;
public gameObject piece4;
}
12 changes: 12 additions & 0 deletions ShipShooter/Assets/Scripts/Legosteroid.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 29 additions & 5 deletions ShipShooter/Assets/Scripts/PlayerHealth.cs
Expand Up @@ -26,6 +26,12 @@ public class PlayerHealth : MonoBehaviour {
public GameObject shieldbar9; public GameObject shieldbar9;
public GameObject shieldbar10; public GameObject shieldbar10;


//Player Position =====================
public Vector3 playerPos;
public Vector3 staticPos;

public float distance;
public int distanceInt;




public int playerHealth = 100; public int playerHealth = 100;
Expand Down Expand Up @@ -62,21 +68,39 @@ public class PlayerHealth : MonoBehaviour {
} }
} }


if (playerHealth == 0)
{
}


//Start----------------------------------------------------------- //Start-----------------------------------------------------------
void Start() void Start()
{ {

staticPos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
} }


// Update---------------------------------------------------------- // Update----------------------------------------------------------
void Update () void Update ()
{ {
//Death Condition ----------------------------
if (playerHealth <= 0)
{
Application.LoadLevel(2);
}
//Shield Regen
playerPos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
distance = Vector3.Distance(playerPos, staticPos);
distanceInt = Mathf.RoundToInt(distance);

if (playerShields < 100)
{
if (distanceInt % 10 == 0)
{
playerShields = playerShields + 10;
// staticPos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
staticPos = playerPos;
}
}

//Shield Switch ------------------------------ //Shield Switch ------------------------------
switch(playerShields) switch (playerShields)
{ {
case 0: case 0:
shieldbar1.SetActive(false); shieldbar1.SetActive(false);
Expand Down
Binary file modified ShipShooter/Library/CurrentLayout.dwlt
Binary file not shown.
Binary file not shown.
Binary file modified ShipShooter/Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
Binary file modified ShipShooter/Library/assetDatabase3
Binary file not shown.
Binary file modified ShipShooter/Library/expandedItems
Binary file not shown.
Binary file modified ShipShooter/Library/metadata/00/00000000000000004000000000000000
Binary file not shown.
Binary file modified ShipShooter/Library/metadata/3d/3d6f92a605a842645b772002f4f174a9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified ShipShooter/Library/metadata/66/664b40cee94497647a1815c7bd525a6c
Binary file not shown.
Binary file modified ShipShooter/Library/metadata/b3/b3fbc82f895666d44928830fde115913
Binary file not shown.
Binary file modified ShipShooter/Library/metadata/b8/b8d9d8ca408b6484eb25aa1be2f7919b
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions ShipShooter/ShipShooter.CSharp.csproj
Expand Up @@ -73,6 +73,7 @@
<Compile Include="Assets\Scripts\Enemy1.cs" /> <Compile Include="Assets\Scripts\Enemy1.cs" />
<Compile Include="Assets\Scripts\Enemy2.cs" /> <Compile Include="Assets\Scripts\Enemy2.cs" />
<Compile Include="Assets\Scripts\EnemySpawner.cs" /> <Compile Include="Assets\Scripts\EnemySpawner.cs" />
<Compile Include="Assets\Scripts\Legosteroid.cs" />
<Compile Include="Assets\Scripts\PlayerControls.cs" /> <Compile Include="Assets\Scripts\PlayerControls.cs" />
<Compile Include="Assets\Scripts\PlayerHealth.cs" /> <Compile Include="Assets\Scripts\PlayerHealth.cs" />
<Compile Include="Assets\iTweenEditor\Examples\StartAndStopTween.cs" /> <Compile Include="Assets\iTweenEditor\Examples\StartAndStopTween.cs" />
Expand Down

0 comments on commit 399042d

Please sign in to comment.