Пример #1
0
    private void Boom()
    {
        TargetBox       expl = this.gameObject.GetComponent <TargetBox>();
        PointEffector2D pe2D = expl.GetComponent <PointEffector2D>();
        SpriteRenderer  s    = expl.GetComponent <SpriteRenderer>();

        pe2D.enabled = true;
        s.enabled    = false;
        Instantiate(ExplosionPrefab, transform.position, Quaternion.identity, transform.parent);
        Invoke("Destruct", 0.1f);
    }
    public void ReplaceTarget(TargetBox target)
    {
        var i = Random.Range(0, maximumAmount - 1);

        target.transform.position = platforms[i].transform.position + Vector3.up;
        target.GetComponent <Rigidbody>().velocity = Vector3.zero;
    }
Пример #3
0
    private void Scored()
    {
        TargetBox      t    = this.gameObject.GetComponent <TargetBox>();
        float          mass = t.GetComponent <Rigidbody2D>().mass;
        SpriteRenderer s    = t.gameObject.GetComponent <SpriteRenderer>();

        if (s.color != Color.green)
        {
            ScoreKeeper.AddToScore(mass);
            s.color = Color.green;
        }
    }