Exemple #1
0
    void Shoot()
    {
        RaycastHit hit;

        if (Physics.Raycast(shotStart.transform.position, shotStart.transform.forward, out hit, gun.range))
        {
            if (hit.transform.tag == "Player" && anim.GetBool("fireNow"))
            {
                if (DefensiveAbility.shieldActive)
                {
                    DefensiveAbility.returnedDamage += gun.damageAmount;
                }
                else
                {
                    health_and_call_titan_script  playerHealth      = hit.transform.gameObject.GetComponent <health_and_call_titan_script>();
                    TitanHealthAndDisembarkScript playerTitanHealth = hit.transform.gameObject.GetComponent <TitanHealthAndDisembarkScript>();
                    if (playerHealth != null)
                    {
                        playerHealth.hit(gun.damageAmount);
                        anim.SetBool("fireNow", false);
                    }
                    if (playerTitanHealth != null)
                    {
                        playerTitanHealth.hit(gun.damageAmount);
                        anim.SetBool("fireNow", false);
                    }
                }
            }
            //else
            //{
            //    Debug.Log("DIDN'T HIT");
            //}
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     rb           = GetComponent <Rigidbody>();
     titan_script = GetComponent <TitanHealthAndDisembarkScript>();
 }