예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (timer > 0 && isActive)
        {
            timer -= Time.deltaTime;
            foreach (Collider hit in colliders)
            {
                Rigidbody rb = hit.GetComponentInParent <Rigidbody>();

                PlayerBehaviour playerScript = hit.GetComponentInParent <PlayerBehaviour>();
                if (rb != null && playerScript != null && playerScript != fromPlayer)
                {
                    if (!playerScript.activeShield)
                    {
                        rb.AddExplosionForce(explosionForce, transform.position, explosionRadius);
                        playerScript.Grounded = true;
                    }
                    else
                    {
                        playerScript.CmdUpdateShield(false);
                    }
                }
            }
        }
        else
        {
            isActive = false;
            GameObject.Destroy(this.gameObject);
        }
    }