using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Food : MonoBehaviour
{
    public GameObject wave;
    private SpriteRenderer sprite;

    public enum FoodType { sushi, gambero, rigatone, scarafaggio };
    public FoodType FoodProperty { get; set; }
    public enum FoodHealth { standard, bad, gold };
    public FoodHealth FoodHealthProperty { get; set; }
    public List<Sprite> sprites;
    public int id;


    void Start ()
    {
        
        
    }
	
	void Update ()
    {
		
	}

    public void timeToDie()
    {
        wave.GetComponent<Wave>().subCounter(gameObject);
    }

    public void setWave(GameObject w)
    {
        this.wave = w;
    }

    public void SetType()
    {
        sprite = GetComponentInChildren<SpriteRenderer>();
        Sprite sp;
        sp = null;
        switch (FoodProperty)
        {
            case FoodType.sushi:
                if (FoodHealthProperty == FoodHealth.gold)
                    sp = sprites[8];
                else if (FoodHealthProperty == FoodHealth.bad)
                    sp = sprites[4];
                else
                    sp = sprites[0];
                break;
            case FoodType.scarafaggio:
                if (FoodHealthProperty == FoodHealth.gold)
                    sp = sprites[11];
                else if (FoodHealthProperty == FoodHealth.bad)
                    sp = sprites[7];
                else
                    sp = sprites[3];
                break;
            case FoodType.gambero:
                if (FoodHealthProperty == FoodHealth.gold)
                    sp = sprites[10];
                else if (FoodHealthProperty == FoodHealth.bad)
                    sp = sprites[6];
                else
                    sp = sprites[2];
                break;
            case FoodType.rigatone:
                if (FoodHealthProperty == FoodHealth.gold)
                    sp = sprites[9];
                else if (FoodHealthProperty == FoodHealth.bad)
                    sp = sprites[5];
                else
                    sp = sprites[1];
                break;
            default:
                sp = sprites[0];
                break;
        }
        sprite.sprite = sp;
    }

}
