clean up test scene and trying to debug raycast
This commit is contained in:
parent
53d4b02ac8
commit
552a049085
@ -30,7 +30,7 @@ AnimationClip:
|
|||||||
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 1
|
time: 1
|
||||||
value: {x: 1, y: 1, z: 1}
|
value: {x: 3, y: 3, z: 3}
|
||||||
inSlope: {x: 0, y: 0, z: 0}
|
inSlope: {x: 0, y: 0, z: 0}
|
||||||
outSlope: {x: 0, y: 0, z: 0}
|
outSlope: {x: 0, y: 0, z: 0}
|
||||||
tangentMode: 0
|
tangentMode: 0
|
||||||
@ -86,7 +86,7 @@ AnimationClip:
|
|||||||
outWeight: 0.33333334
|
outWeight: 0.33333334
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 1
|
time: 1
|
||||||
value: 1
|
value: 3
|
||||||
inSlope: 0
|
inSlope: 0
|
||||||
outSlope: 0
|
outSlope: 0
|
||||||
tangentMode: 136
|
tangentMode: 136
|
||||||
@ -114,7 +114,7 @@ AnimationClip:
|
|||||||
outWeight: 0.33333334
|
outWeight: 0.33333334
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 1
|
time: 1
|
||||||
value: 1
|
value: 3
|
||||||
inSlope: 0
|
inSlope: 0
|
||||||
outSlope: 0
|
outSlope: 0
|
||||||
tangentMode: 136
|
tangentMode: 136
|
||||||
@ -142,7 +142,7 @@ AnimationClip:
|
|||||||
outWeight: 0.33333334
|
outWeight: 0.33333334
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 1
|
time: 1
|
||||||
value: 1
|
value: 3
|
||||||
inSlope: 0
|
inSlope: 0
|
||||||
outSlope: 0
|
outSlope: 0
|
||||||
tangentMode: 136
|
tangentMode: 136
|
||||||
|
|||||||
@ -11,7 +11,6 @@ GameObject:
|
|||||||
- component: {fileID: 1039445016908976971}
|
- component: {fileID: 1039445016908976971}
|
||||||
- component: {fileID: 5972276832283679259}
|
- component: {fileID: 5972276832283679259}
|
||||||
- component: {fileID: 1790704820881565271}
|
- component: {fileID: 1790704820881565271}
|
||||||
- component: {fileID: 6221104859356534203}
|
|
||||||
- component: {fileID: 7767178052037687813}
|
- component: {fileID: 7767178052037687813}
|
||||||
- component: {fileID: 2748099788876613564}
|
- component: {fileID: 2748099788876613564}
|
||||||
- component: {fileID: 5856909421887883047}
|
- component: {fileID: 5856909421887883047}
|
||||||
@ -32,7 +31,7 @@ Transform:
|
|||||||
m_GameObject: {fileID: 4677231174284622268}
|
m_GameObject: {fileID: 4677231174284622268}
|
||||||
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: 22.7, z: 70.77}
|
m_LocalPosition: {x: 0, y: 22.7, z: 70.77}
|
||||||
m_LocalScale: {x: 20, y: 20, z: 20}
|
m_LocalScale: {x: 47.045998, y: 47.045998, z: 47.045998}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -88,19 +87,6 @@ MeshRenderer:
|
|||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_AdditionalVertexStreams: {fileID: 0}
|
m_AdditionalVertexStreams: {fileID: 0}
|
||||||
--- !u!65 &6221104859356534203
|
|
||||||
BoxCollider:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 4677231174284622268}
|
|
||||||
m_Material: {fileID: 0}
|
|
||||||
m_IsTrigger: 0
|
|
||||||
m_Enabled: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Size: {x: 1, y: 1, z: 1}
|
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &7767178052037687813
|
--- !u!114 &7767178052037687813
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -158,5 +144,5 @@ SphereCollider:
|
|||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Radius: 1
|
m_Radius: 1.37
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -22,12 +22,18 @@ public class CannonScript : MonoBehaviour
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
lookDir = Vector3.zero;
|
lookDir = Vector3.zero;
|
||||||
|
if(EventSystem.current == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("No Event System");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if(firing && !EventSystem.current.IsPointerOverGameObject()){
|
Debug.DrawRay(transform.position, lookDir * Mathf.Infinity, Color.red);
|
||||||
|
|
||||||
|
if (firing && !EventSystem.current.IsPointerOverGameObject()){
|
||||||
fireTimer += Time.deltaTime;
|
fireTimer += Time.deltaTime;
|
||||||
if(fireTimer >= fireRate){
|
if(fireTimer >= fireRate){
|
||||||
GameObject proj = Instantiate(projectile, transform.position, cannon.transform.rotation);
|
GameObject proj = Instantiate(projectile, transform.position, cannon.transform.rotation);
|
||||||
@ -43,6 +49,8 @@ public class CannonScript : MonoBehaviour
|
|||||||
|
|
||||||
GameObject hitObject = hit.collider.gameObject;
|
GameObject hitObject = hit.collider.gameObject;
|
||||||
|
|
||||||
|
Debug.Log(hitObject.name);
|
||||||
|
|
||||||
if (hitObject.tag == "Enemy")
|
if (hitObject.tag == "Enemy")
|
||||||
{
|
{
|
||||||
hitObject.GetComponent<Enemy>().IsShot();
|
hitObject.GetComponent<Enemy>().IsShot();
|
||||||
@ -75,7 +83,6 @@ public class CannonScript : MonoBehaviour
|
|||||||
firing = true;
|
firing = true;
|
||||||
}else if(ctx.canceled){//btn released
|
}else if(ctx.canceled){//btn released
|
||||||
firing = false;
|
firing = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public class Enemy : MonoBehaviour
|
|||||||
|
|
||||||
void SpawnFinished()
|
void SpawnFinished()
|
||||||
{
|
{
|
||||||
Launch();
|
StartCoroutine("Launch", 0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: find direction between spawn point and landing point
|
//TODO: find direction between spawn point and landing point
|
||||||
@ -33,8 +33,9 @@ public class Enemy : MonoBehaviour
|
|||||||
this.launchDirection = transform.position - landingPoint.position;
|
this.launchDirection = transform.position - landingPoint.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launch()
|
IEnumerator Launch()
|
||||||
{
|
{
|
||||||
|
yield return new WaitForSeconds(.1f);
|
||||||
gameObject.GetComponent<Rigidbody>().velocity = gameObject.transform.forward * flyingSpeed;
|
gameObject.GetComponent<Rigidbody>().velocity = gameObject.transform.forward * flyingSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user