Skip to content
Snippets Groups Projects
Commit d6c64a1e authored by Malik Rafsanjani's avatar Malik Rafsanjani
Browse files

fix: add colider for hitting enemy

parent 76aa64f0
No related merge requests found
......@@ -90,14 +90,28 @@ Rigidbody:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5605313144142574835}
serializedVersion: 2
m_Mass: 0.05
m_Mass: 0.1
m_Drag: 0
m_AngularDrag: 0.05
m_AngularDrag: 0
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!136 &8899688315378107407
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5605313144142574835}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.3
m_Height: 20
m_Direction: 1
m_Center: {x: 0, y: 0, z: -1}
--- !u!114 &5707969127914954734
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -111,4 +125,4 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
damage: 200
torque: 10
torque: 0
......@@ -36,6 +36,5 @@ public class PlayerArrow : MonoBehaviour
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
rb.isKinematic = true;
transform.SetParent(other.transform);
}
}
......@@ -18,7 +18,7 @@ public class PlayerBow : MonoBehaviour
void Awake()
{
ReloadArrow();
//ReloadArrow();
}
public void Reload()
......@@ -30,10 +30,9 @@ public class PlayerBow : MonoBehaviour
void Update()
{
if (Input.GetKeyDown(KeyCode.J))
if (Input.GetMouseButtonDown(0))
{
Debug.Log("Click J");
Shoot(5);
Shoot();
}
}
......@@ -50,13 +49,12 @@ public class PlayerBow : MonoBehaviour
isReload = false;
}
public void Shoot(float power)
public void Shoot()
{
Debug.Log("isReload: " + isReload);
curArrow = Instantiate(playerArrowPrefab, transform.position, arrowSpawnPoint.transform.rotation);
var force = curArrow.transform.forward;
curArrow.GetComponent<Rigidbody>().AddRelativeForce(force * -20);
Reload();
curArrow.GetComponent<Rigidbody>().AddRelativeForce(force * -40);
// Reload();
}
public bool IsReady()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment