using UnityEngine;
using System.Collections;

public class ElementalCommandFactory : Singleton<ElementalCommandFactory>
{
    public AudioClip soulSound;
    public AudioClip electricSound;
    public AudioClip plasmaSound;
    public AudioClip fireSound;
    public AudioClip mercurySound;
    public AudioClip lifeSound;

	public IElementalCommand CommandForElement(Element element, ElementalAspect aspect)
	{
        IElementalCommand command = null;
		if (element == Element.Soul) {
            if (aspect == ElementalAspect.Movement) {
    			command = new DudCommand();
            } else if (aspect == ElementalAspect.Attack) {
				command = new FireWeaponCommand().WeaponType(0).ElementalType(element);
            } else if (aspect == ElementalAspect.Defense) {
                command = new HealCommand();
            }
            command.clip = soulSound;

		} else if (element == Element.Electricity) {
            if (aspect == ElementalAspect.Movement) {
                command = new DudCommand();
            } else if (aspect == ElementalAspect.Attack) {
                command = new FireWeaponCommand().WeaponType(0).ElementalType(element);
            } else if (aspect == ElementalAspect.Defense) {
                command = new HealCommand();
            }
            command.clip = electricSound;

		} else if (element == Element.Plasma) {
            if (aspect == ElementalAspect.Movement) {
                command = new MoveCommand().SpeedFactor(2f);
            } else if (aspect == ElementalAspect.Attack) {
				command = new FireWeaponCommand().WeaponType(0).ElementalType(element);
            } else if (aspect == ElementalAspect.Defense) {
                command = new AttractRepulseCommand();
            }
            command.clip = plasmaSound;

		} else if (element == Element.Fire) {
            if (aspect == ElementalAspect.Movement) {
                command = new TurboCommand();
            } else if (aspect == ElementalAspect.Attack) {
				command = new FireWeaponCommand().WeaponType(0).ElementalType(element);
            } else if (aspect == ElementalAspect.Defense) {
                command = new DudCommand();
            }
            command.clip = fireSound;

		} else if (element == Element.Mercury) {
            if (aspect == ElementalAspect.Movement) {
                command = new MoveCommand().SpeedFactor(1f);
            } else if (aspect == ElementalAspect.Attack) {
				command = new FireWeaponCommand().WeaponType(0).ElementalType(element);
            } else if (aspect == ElementalAspect.Defense) {
                command = new HurtCommand();
            }
            command.clip = mercurySound;

		} else if (element == Element.Life) {
            if (aspect == ElementalAspect.Movement) {
                command = new SpinoutCommand();
            } else if (aspect == ElementalAspect.Attack) {
				command = new FireWeaponCommand().WeaponType(0).ElementalType(element);
            } else if (aspect == ElementalAspect.Defense) {
                command = new HealCommand();
            }
            command.clip = lifeSound;
        }
        return command;
	}

}