コード例 #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>();
            }
        }
    }