コード例 #1
0
ファイル: PointsPickerUpper.cs プロジェクト: 2tmb2/TD
    void OnTriggerEnter(Collider coll)
    {
        PointsPickup pu = coll.GetComponent <PointsPickup> ();

        if (pu != null)
        {
            GameObject.Destroy(pu.gameObject);
            _pointsHUD.AddPoints(pu.points);
        }
    }
コード例 #2
0
    void SpawnPointsPickup()
    {
        GameObject newPickup = pointsPooler.GetPooledObject();

        if (newPickup != null)
        {
            PointsPickup newPickupScript = newPickup.GetComponent <PointsPickup>();
            newPickupScript.gameControllerInstance = this.gameObject;
            newPickupScript.points   = Random.Range(1, 5);
            newPickupScript.position = new Vector3(Random.Range(-4f, 4f), Random.Range(-1.5f, 1.5f), 0f);
            newPickup.SetActive(true);
        }
    }