forked from Wireline-Studios/JourneyProject
Rocket deals damage
This commit is contained in:
@@ -105,7 +105,7 @@ BoxCollider:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 0
|
m_Bits: 0
|
||||||
m_LayerOverridePriority: 0
|
m_LayerOverridePriority: 0
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 1
|
||||||
m_ProvidesContacts: 0
|
m_ProvidesContacts: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
|
|||||||
BIN
Assets/Scenes/Scene1-Boss.unity
LFS
BIN
Assets/Scenes/Scene1-Boss.unity
LFS
Binary file not shown.
@@ -2,6 +2,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class Rocket : MonoBehaviour
|
public class Rocket : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public PlayerMovement playerMovement;
|
||||||
public GameObject player;
|
public GameObject player;
|
||||||
public Vector3 TargetPosition;
|
public Vector3 TargetPosition;
|
||||||
public float playerDistance;
|
public float playerDistance;
|
||||||
@@ -16,6 +17,7 @@ public class Rocket : MonoBehaviour
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
player = GameObject.Find("Player");
|
player = GameObject.Find("Player");
|
||||||
|
playerMovement = FindObjectOfType<PlayerMovement>();
|
||||||
TargetPosition = player.transform.position;
|
TargetPosition = player.transform.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,4 +38,19 @@ public class Rocket : MonoBehaviour
|
|||||||
playerDistance = Vector3.Distance(transform.position, player.transform.position);
|
playerDistance = Vector3.Distance(transform.position, player.transform.position);
|
||||||
transform.Translate(Vector3.forward * Time.deltaTime * (playerDistance/1.5f+8));
|
transform.Translate(Vector3.forward * Time.deltaTime * (playerDistance/1.5f+8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnTriggerEnter(Collider other)
|
||||||
|
{
|
||||||
|
if (other.CompareTag("Player"))
|
||||||
|
{
|
||||||
|
Debug.Log("Hit Player");
|
||||||
|
playerMovement.HP -= 2f;
|
||||||
|
}
|
||||||
|
else if (other.CompareTag("Boss")){
|
||||||
|
Debug.Log("Shooting");
|
||||||
|
}
|
||||||
|
else if (other.CompareTag("Ground")){
|
||||||
|
Destroy(this.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ public class SteampunkBoss : MonoBehaviour
|
|||||||
public GameObject LungeHitbox;
|
public GameObject LungeHitbox;
|
||||||
public float lungeBackup;
|
public float lungeBackup;
|
||||||
|
|
||||||
|
public GameObject Rocket;
|
||||||
|
public bool rocketShot = false;
|
||||||
|
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@@ -98,10 +101,16 @@ public class SteampunkBoss : MonoBehaviour
|
|||||||
{
|
{
|
||||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, -30 * Time.deltaTime);
|
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, -30 * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
else if (!rocketShot)
|
||||||
|
{
|
||||||
|
Instantiate(Rocket, transform.position, transform.rotation);
|
||||||
|
rocketShot = true;
|
||||||
|
}
|
||||||
stallTimer -= Time.deltaTime;
|
stallTimer -= Time.deltaTime;
|
||||||
if (stallTimer <= 0)
|
if (stallTimer <= 0)
|
||||||
{
|
{
|
||||||
setposition = false;
|
setposition = false;
|
||||||
|
rocketShot = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ TagManager:
|
|||||||
- Sword
|
- Sword
|
||||||
- WagonPoint
|
- WagonPoint
|
||||||
- Ground
|
- Ground
|
||||||
|
- Boss
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|||||||
Reference in New Issue
Block a user