Beispiel #1
0
    // Update is called once per frame
    public void throwParts(CarParts.partsList partsType)
    {
        GameObject     partsThrown = junkPartsPool.pullObject();
        SpriteRenderer sp          = partsThrown.GetComponent <SpriteRenderer> ();

        sp.sprite = CarPartsSpriteArray [(int)partsType];
        partsThrown.GetComponent <FlungPartsMovement>().throws();
        AudioController.Play("SFX_PartsFlying");
    }
Beispiel #2
0
    void spawnObject()
    {
        float randChoice = Random.Range(0, 4);

        if (randChoice < 3 && rocksRow < maxRocksRow)
        {
            //Instantiate(rock, new Vector3(Random.Range(leftBoundaryX, rightBoundaryX), topScreenY, 0), Quaternion.identity);
            GameObject rock = rockPool.pullObject();
            rock.transform.position = new Vector3(Random.Range(leftBoundaryX, rightBoundaryX), topScreenY, 0);
            rock.transform.rotation = Quaternion.identity;

            rocksRow++;
        }
        else
        {
            // GameObject npcCar = Instantiate(car, new Vector3(Random.Range(leftBoundaryX, rightBoundaryX), topScreenY, 0), Quaternion.identity);
            GameObject npcCar = carPool.pullObject();
            npcCar.transform.position = new Vector3(Random.Range(leftBoundaryX, rightBoundaryX), topScreenY, 0);
            npcCar.transform.rotation = Quaternion.identity;
            npcCar.GetComponent <CarPartsSpawner>().explosion = explosion;
            rocksRow = 0;
        }
    }