- Home /
Question by
InvictusCo · Mar 12, 2017 at 03:18 PM ·
unity 5javascriptgun scriptgunfiregun-animation
"WARNING: Boolean expression will always have the same value."
Hello! I am trying to make it to where my gun won't fire until the reload animation is finished, but I'm having some trouble. I don't see what is wrong with {if (!gameObject.transform.parent.transform.FindChild("Gun").GetComponent.<Animation>().isPlaying)
, but hopefully, you could help me fix it! In another script that's actually attached to the gun itself, {if (!GetComponent.<Animation>().isPlaying)
works fine.
var DamageAmount : int = 34;
var TargetDistance : float;
var AllowedRange : float = 75;
function Update()
{if (!gameObject.transform.parent.transform.FindChild("Gun").GetComponent.<Animation>().isPlaying) {
{if(Input.GetButtonDown("Attack"))
{var Shot : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), Shot))
{TargetDistance = Shot.distance;
if (TargetDistance < AllowedRange)
{Shot.transform.SendMessage("DeductPoints", DamageAmount);}}}}}}
Comment