Exemple #1
0
    // Use this for initialization
    private void Start()
    {
        Destroy(gameObject, 5.0f); // Destroy after 5 seconds

        _rb = GetComponent <Rigidbody2D>();

        // Set damage based on power of shot
        if (Player.Power >= 70.0f)
        {
            Damage = 30.0f;
        }
        else
        {
            Damage = 10.0f;
        }

        // Say whether enemy shot or friendly shot
        if (Player.CompareTag("Player"))
        {
            gameObject.tag = "PlayerProjectile";
        }
        else
        {
            gameObject.tag = "EnemyProjectile";
        }
    }