Inheritance: MonoBehaviour
示例#1
0
文件: Classes.cs 项目: zoze/Training
 public CoffeeMaker(WaterCompartment waterCompartment, CoffeePot coffeePot,
                    Water water)
 {
     WaterCompartment = waterCompartment;
     CoffeePot        = coffeePot;
     Water            = water;
 }
    // Define what to do when a player interacts with the coffeemachine
    public void Interact(GameObject player)
    {
        PlayerInventory inv = player.GetComponent <PlayerController> ().GetInventory();

        if (inv.coffeePot != null && cpot == null)
        {
            cpot               = inv.coffeePot;
            inv.coffeePot      = null;
            currentBrewingTime = brewingTime;
            canimator.SetFloat("brewingTimeMultiplier", (1f / brewingTime));
            canimator.SetBool("brewing", true);
            canimator.SetBool("empty", false);
            caudio.Play();
        }
        else if (currentBrewingTime <= 0 && cpot != null && inv.coffeePot == null)
        {
            cpot.fill(cpot.getMaxFillLevel());
            inv.coffeePot = cpot;
            cpot          = null;
            canimator.SetBool("empty", true);
        }
    }
    public bool CanInteract(GameObject player)
    {
        CoffeePot pcpot = player.GetComponent <PlayerController>().GetInventory().coffeePot;

        return((pcpot != null && pcpot.getFillLevel() != pcpot.getMaxFillLevel() && cpot == null) ^ (cpot != null && currentBrewingTime <= 0 && pcpot == null));
    }
示例#4
0
    public override bool CanInteract(GameObject player)
    {
        CoffeePot pcpot = player.GetComponent <PlayerController> ().GetInventory().coffeePot;

        return(pcpot != null && pcpot.getFillLevel() != 0f && this.coffeeTimer <= this.coffeeTimer_init * 0.95);
    }