Пример #1
0
    public override void SuccessfullyClick()
    {
        if (rb != null && gameObject != null)
        {
            if (!pointsEarned && PowerUpButton.activePowerUps.Count > 0 && Random.Range(0, Random.Range(85, 95)) < 2)
            {
                PowerUp          powerUp = PowerUpButton.DeterminePowerUp();
                ClickForPoints2D spawn   = ObjectSpawner.GetSpawn(powerUp);
                spawn = Instantiate(spawn, null);
                spawn.Reposition(transform.position);
                spawn.transform.parent = null;
                spawn.gameObject.SetActive(true);
            }

            rb.isKinematic = false;
            rb.AddForce(Vector3.down * 200f, ForceMode.Acceleration);

            base.SuccessfullyClick();

            MaterialChanger m = GetComponentInChildren <MaterialChanger>();
            if (m != null)
            {
                m.enabled = true;
            }

            Collider c = GetComponent <Collider>();
            if (c != null)
            {
                Destroy(c);
            }
        }
    }