public virtual void Catch(CharacterControllerAct player) { rigidbodyController.ActiveRigidbody(false); transform.parent = player.attachTransform; transform.position = player.attachTransform.position; player.attachedObject = gameObject; }
public override void LeaveObjOn(CharacterControllerAct player) { if (!hasObjectOn) { item = player.attachedObject.GetComponent <Item>(); if (item.itemType == ItemType.Vial) { VialItem vialItem = item.GetComponent <VialItem>(); // Crear ordre o mirar si a llist of orders hi ha ordres d'aquest item bool check = OrderManager.Instance.CheckAllOrder(vialItem); Debug.Log("orderc check" + check); if (check) { StartCoroutine(TextWide(5f, "Order get")); } else { StartCoroutine(TextWide(5f, "Order Wrong")); } vialItem.ResetVial(); base.LeaveObjOn(player); VialPool.Instance.ReturnToPool(vialItem); hasObjectOn = false; } else { StartCoroutine(TextWide(5f, "Needs a Vial")); } } }
public override void LeaveObjOn(CharacterControllerAct player) { if (!hasObjectOn) { item = player.attachedObject.GetComponent <Item>(); if (item.itemType == ItemType.Ing) { if (item.GetType() == typeof(Ingredient2)) { player.attachedObject = null; item.transform.parent = null; item.transform.localScale = new Vector3(0.85f, 0.85f, 0.85f); Ingredient2Pool.Instance.ReturnToPool((Ingredient2)item); } else { player.attachedObject = null; item.transform.parent = null; item.transform.localScale = new Vector3(0.85f, 0.85f, 0.85f); Ing1Pool.Instance.ReturnToPool((Ing11)item); } } else if (item.itemType == ItemType.Pot) { ItemPot itemPot = item.GetComponent <ItemPot>(); itemPot.ResetPot(); } } }
public override void Catch(CharacterControllerAct player) { // The player just can catch items cutted or raw if (item != null) { if (item.stateIngredient == StateIngredient.cutted || item.stateIngredient == StateIngredient.raw) { base.Catch(player); } } }
public override void LeaveObjOn(CharacterControllerAct player) { if (item != null) { if (item.itemType == ItemType.Pot) { Item itemPlayer = player.attachedObject.GetComponent <Item>(); if (itemPlayer.itemType == ItemType.Ing) { if (itemPlayer.stateIngredient == StateIngredient.cutted) { Debug.Log("ssm"); //item.transform.p;arent = null; Item ItemClonIngredient = itemPlayer.Clone(); ItemPot itempot = item.GetComponent <ItemPot>(); if (itempot.listItem.Count < itempot.potUi.listUIItems.Capacity) { //Affegeixo ItemClon a llista items del ItemPot que tinc a sobre itempot.LeaveObjIn(ItemClonIngredient); // desparent the player attached obj player.attachedObject = null; // put the ItemClonIngredient child of itemPot ItemClonIngredient.transform.parent = item.transform; // if ItemPlayer type is Ingredient2 if (itemPlayer.GetType() == typeof(Ingredient2)) { // return to pool Ingredient2Pool.Instance.ReturnToPool(itemPlayer.GetComponent <Ingredient2>()); } else { //Return to pool Ing1Pool.Instance.ReturnToPool(itemPlayer.GetComponent <Ing11>()); } // flag xq no pugui afegir 2 cops els igredients hasPassIngToVial = false; } } } } else if (item.itemType == ItemType.Vial) { Item i = player.attachedObject.GetComponent <Item>(); if (i.itemType == ItemType.Pot) { } } } else { base.LeaveObjOn(player); } }
public override void Catch(CharacterControllerAct player) { // si player te fracco i recepta feta //passar ing dde olla a frasco // sino sta feta recpta i tens frasco no agafes recepte if (player.attachedObject == null) { base.Catch(player); } }
public bool hasObjectOn; //Object in slot public virtual void Catch(CharacterControllerAct player) { if (hasObjectOn) { item.transform.parent = player.attachTransform; item.transform.position = player.attachTransform.position; player.attachedObject = item.gameObject; item.gameObject.GetComponent <Rigidbody>().isKinematic = false; hasObjectOn = false; item = null; } }
public virtual void LeaveObjOn(CharacterControllerAct player) { if (!hasObjectOn) { hasObjectOn = true; player.attachedObject.GetComponent <Rigidbody>().isKinematic = true; player.attachedObject.transform.parent = positionObjOn.transform; item = player.attachedObject.GetComponent <Item>(); item.transform.position = positionObjOn.transform.position; player.attachedObject = null; } }
public override void LeaveObjOn(CharacterControllerAct player) { Item i = player.attachedObject.GetComponent <Item>(); if (i.itemType == ItemType.Ing) { base.LeaveObjOn(player); if (i.stateIngredient == StateIngredient.raw) { barCanvas.SetActive(true); progresBar.fillAmount = 0; } } }
public override void Action(CharacterControllerAct player) { if (item != null) { if (item.stateIngredient == StateIngredient.raw || item.stateIngredient == StateIngredient.cutting) { item.stateIngredient = StateIngredient.cutting; fillAmount += progresSpeed * Time.deltaTime; progresBar.fillAmount = fillAmount; if (fillAmount >= 1) { fillAmount = 0; barCanvas.SetActive(false); item.transform.localScale = new Vector3(0.7f, 0.4f, 0.7f); item.stateIngredient = StateIngredient.cutted; } } } }
public override void LeaveObjOn(CharacterControllerAct player) { /// si tinc objecte a sobre if (item != null) { // si obj q tinx es pot if (item.itemType == ItemType.Pot) { // si player be amb obj i es ingredient Item itemPlayer = player.attachedObject.GetComponent <Item>(); if (itemPlayer.itemType == ItemType.Ing) { /// si ingredient esta cutted if (itemPlayer.stateIngredient == StateIngredient.cutted) { //clono itemplayer Item ItemClonIngredient = itemPlayer.Clone(); ItemPot itempot = item.GetComponent <ItemPot>(); //s al agafa el ing fets del pot if (itempot.listItem.Count < itempot.potUi.listUIItems.Count) { if (itempot.currentStatePot != ItemPotStateIngredients.Burning || itempot.currentStatePot != ItemPotStateIngredients.BurnedToTrash) { //Affegeixo ItemClon a llista items del ItemPot que tinc a sobre if (itempot.LeaveObjIn(ItemClonIngredient)) { // desparent the player attached obj player.attachedObject = null; // put the ItemClonIngredient child of itemPot ItemClonIngredient.transform.parent = item.transform; // if ItemPlayer type is Ingredient2 if (itemPlayer.GetType() == typeof(Ingredient2)) { // return to pool Ingredient2Pool.Instance.ReturnToPool(itemPlayer.GetComponent <Ingredient2>()); } else { //Return to pool Ing1Pool.Instance.ReturnToPool(itemPlayer.GetComponent <Ing11>()); } // flag xq no pugui afegir 2 cops els igredients hasPassIngToVial = false; } } } } } else if (itemPlayer.itemType == ItemType.Vial) { ItemPot ItemPot = item.GetComponent <ItemPot>(); if (!hasPassIngToVial) { //aqui if (ItemPot.currentStatePot == ItemPotStateIngredients.Alert || ItemPot.currentStatePot == ItemPotStateIngredients.CookedDone) { player.attachedObject.GetComponent <VialItem>().listItem = new List <Item>(ItemPot.listItem); player.attachedObject.GetComponent <VialItem>().ChangeMaterial(); ItemPot.ResetPot(); hasPassIngToVial = true; } else { //Todo ErrorOnScreen } } } } } else { Item itemPlayer = player.attachedObject.GetComponent <Item>(); if (itemPlayer.itemType == ItemType.Pot) { base.LeaveObjOn(player); } } // mirar al joc si es poden fgr }
private void Start() { ccAct = GetComponent <CharacterControllerAct>(); }
public override void Catch(CharacterControllerAct player) { base.Catch(player); hasObjectOn = true; }
public override void Catch(CharacterControllerAct player) { base.Catch(player); item = Ing1Pool.Instance.GetObjFromPool(transform); }
public virtual void Action(CharacterControllerAct player) { }
public override void Catch(CharacterControllerAct player) { base.Catch(player); }
public override void Catch(CharacterControllerAct player) { base.Catch(player); item = VialPool.Instance.GetObjFromPool(spawnTransform); hasObjectOn = true; }