//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34209
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using UnityEngine;

public class PizzaSpeciality
{
	/* as declared in PizzaMakerManager
	
	private int TOPPING_BASE = 0;
	private int TOPPING_CHEESE = 1;
	private int TOPPING_PEPPERONI = 2;
	private int TOPPING_PEPPER = 3;
	private int TOPPING_OLIVE = 4;
	private int TOPPING_MUSHROOM = 5;
	private int TOPPING_PINEAPPLE = 6;
	private int TOPPING_HAM = 7;
	private int TOPPING_ONION = 8;

	private int TOPPING_COUNT = 9;
	*/
	
	public static int[] PEPPERONI 	= new int[] {1,1,1,0,0,0,0,0,0};
	public static int[] HAWAIIAN 	= new int[] {1,1,0,0,0,0,1,1,0};
	public static int[] VEGGIE 		= new int[] {1,1,0,1,1,1,0,0,1};
	public static int[] SUPREME 	= new int[] {1,1,1,1,1,1,0,1,1};
	public static int[] CHEESE 		= new int[] {1,1,0,0,0,0,0,0,0};
	
	
	
	
	public int[] TOPPING_ENABLED;
	public int TOPPING_COUNT;

	public PizzaSpeciality()
	{
	}

	public PizzaSpeciality (int count)
	{
		TOPPING_COUNT = count;
	
		TOPPING_ENABLED = new int[TOPPING_COUNT];
		for (int i = 0; i < (TOPPING_COUNT); i++)
		{
			TOPPING_ENABLED[i] = 0;
		}		
	}
	
	public PizzaSpeciality(int[] args)
	{
		TOPPING_COUNT = args.Length;
		
		Debug.Log("Setting Speciality: " + args);
		
		TOPPING_ENABLED = new int[TOPPING_COUNT];
		for (int i = 0; i < (TOPPING_COUNT); i++)
		{
			TOPPING_ENABLED[i] = args[i];
		}	
	}
	
	
	public bool Compare(int[] pizza)
	{
		Debug.Log("Comparing " + PrintArray(TOPPING_ENABLED) + " to " + PrintArray(pizza));
	
		if (pizza.Length == TOPPING_ENABLED.Length)
		{
			for (int i = 0; i < TOPPING_COUNT; i++)
			{
				if (TOPPING_ENABLED[i] != pizza[i])
					return false;
			}
		}
	
		return true;
	}
	
	
	public void setPizza(int[] pizza)
	{
		if (pizza.Length == TOPPING_ENABLED.Length)
			TOPPING_ENABLED = pizza;
	
	} 
	
	public string CheckSpeciality()
	{
		if (Compare (PizzaSpeciality.PEPPERONI))
			return "PEPPERONI";
			
		if (Compare (PizzaSpeciality.HAWAIIAN))
			return "HAWAIIAN";

		if (Compare (PizzaSpeciality.VEGGIE))
		    return "VEGGIE";

		if (Compare (PizzaSpeciality.SUPREME))
		    return "SUPREME";
		    
		if (Compare (PizzaSpeciality.CHEESE))
		    return "CHEESE";
		    
		return "";								
	}
	
	public string PrintArray(int[] a)
	{
		string s = "";
		for (int i = 0; i < a.Length - 1; i++)
			s += a[i] + ", ";
			
		s += a[a.Length - 1];
	
		return s;
	}
	
	
}

