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); } } }
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); }
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; }
private void OnMushroomGotEvent(MushroomBehaviour mushroom) { // add the score value for the enemy to the player score playerScore += mushroom.scoreValueForMushroom; UpdateScore(); }