예제 #1
0
    public void HitByProjectile(StandardProjectile proj)
    {
        currentHealth -= proj.damage;

        if (currentHealth <= 0)
        {
            GameObject.Destroy(gameObject);
        }
    }
예제 #2
0
    public void HitByProjectile(StandardProjectile proj)
    {
        currentHealth -= proj.damage;

        if (currentHealth <= 0)
        {
            GameObject.Destroy(gameObject);
        }
    }
예제 #3
0
    // Update is called once per frame
    void Update()
    {
        timeSinceLastShot += Time.deltaTime;

        if (timeSinceLastShot >= refireRate && playerCtrl.isShooting)
        {
            timeSinceLastShot = 0.0f;

            for (int i = 0; i < numShots; ++i)
            {
                GameObject         proj     = Instantiate(projectilePrefab, transform.position, Quaternion.identity) as GameObject;
                StandardProjectile projInfo = proj.GetComponent <StandardProjectile>();
            }
        }
    }