Ejemplo n.º 1
0
    private void spawnSomething()
    {
        float      pickRdm = Random.value;
        float      dirRdm  = Random.value;
        GameObject curObj;
        Vector3    spawnPos = new Vector3(transform.position.x + (float)getDeltaPos(), transform.position.y, transform.position.z);

        if (pickRdm > 0.5f)
        {
            curObj = ((GameObject)Instantiate(goomba, spawnPos, Quaternion.identity));
            if (dirRdm > 0.5f)
            {
                GoombaBehaviour goom = curObj.transform.GetChild(0).GetComponent <GoombaBehaviour>();
                goom.revertSpeed();
            }
        }
        else
        {
            curObj = ((GameObject)Instantiate(mushroom, spawnPos, Quaternion.identity));
            if (dirRdm > 0.5f)
            {
                MushroomBehaviour shroom = curObj.GetComponent <MushroomBehaviour>();
                shroom.changeDir(Vector3.left);
            }
        }
    }
Ejemplo n.º 2
0
    private MushroomDescriptor GetDescriptorFor(int x, int y, MushroomBehaviour mushroomBehaviour, MushroomColor mushroomColor)
    {
        MushroomDescriptor mushroomDescriptor = new MushroomDescriptor();

        mushroomDescriptor.mPos       = new Vector2Int(x, y);
        mushroomDescriptor.mBehaviour = mushroomBehaviour;
        mushroomDescriptor.mColor     = mushroomColor;

        return(mushroomDescriptor);
    }
Ejemplo n.º 3
0
    private void SpawnMushroom(GameObject mushroomPrefab, int x, int y, MushroomBehaviour mushroomBehaviour, MushroomColor color)
    {
        GameObject mushroom = Instantiate(mushroomPrefab, mPots[x][y].transform);

        MushroomControlerDeVerdad mushCon = mushroom.GetComponent <MushroomControlerDeVerdad>();

        mushCon.mBoardController   = this;
        mushCon.mPos               = new Vector2Int(x, y);
        mushCon.mMushroomBehaviour = Instantiate <MushroomBehaviour>(mushroomBehaviour);
        mushCon.mMushroomBehaviour.mMushroomColor = color;
    }
Ejemplo n.º 4
0
 private void OnMushroomGotEvent(MushroomBehaviour mushroom)
 {
     // add the score value for the enemy to the player score
     playerScore += mushroom.scoreValueForMushroom;
     UpdateScore();
 }