Exemplo n.º 1
0
	private void Create()
	{
		int chance = (int)(Random.value * 100);
		int specie = 1;

		//**** We dont use this part.
		//**** But i decide to put this code here to auxiliate you if you like to use.
		//**** random percentage to know what 'personality' our food will have.

		//COIN
		if (chance <= probabCoin)
		{
			foodType = EnumFoodType.Coin;
			foodEffect = EnumFoodEffect.Coin;
			specie = 0;	//appearance of our food.
		}
		//FOOD
		else
		{
			foodType = EnumFoodType.Bug;
			foodEffect = EnumFoodEffect.Feed;
			specie =   Random.Range (1,9); //((Random.value + 0.2f) * 10)-1; //rands between 1-10.
		}

		//use that array of prefabs to get renderer by position of 'specie'.
		this.GetComponent<SpriteRenderer>().sprite = foodKinds[specie];

		_qtd++; //just to know how many food has been created.
	}
Exemplo n.º 2
0
 public static DailyReportFood Create(string food, EnumFoodType foodType, Guid mealId, string userId)
 {
     return(new DailyReportFood()
     {
         CreatedById = userId,
         FoodType = foodType,
         DailyReportMealId = mealId,
         Food = food,
     });
 }