I have a basic cube (enemy) and sphere (hammer), both of which have rigidbodies attached. I have a script attached to the sphere so it follows the mouse cursor.
My overall intention is, if I hover the sphere over the enemy and click the left button, it will stun the enemy for a duration.
If I attach this script to the enemy:
function OnTriggerEnter (other : Collider)
{
if(other.tag == "sphere")
{
Debug.Log ("Stun");
}
}
Then when I hover the sphere over the enemy, the log will output correctly. However, if I try to add an && like so:
function OnTriggerEnter (other : Collider)
{
if(Input.GetMouseButtonDown(0)) && if(other.tag == "sphere")
{
Debug.Log ("Stun");
}
}
I get BCE0043: Unexpected token: &&
What am I doing wrong?