private void PrintRecipe(PickableObject pickableObject) { feedback = Instantiate(feedBackPrefab); SpriteRenderer image; for (int i = 0; i < 3; i++) { image = feedback.transform.GetChild(0).GetChild(i).GetComponent <SpriteRenderer>(); if (pickableObject.GetComponent <RepairableObject>().RecipeToDo[i] == RepairObject.CIRCUIT) { image.sprite = resourceSprite[0].Sprite; } else if (pickableObject.GetComponent <RepairableObject>().RecipeToDo[i] == RepairObject.CLOU) { image.sprite = resourceSprite[1].Sprite; } else if (pickableObject.GetComponent <RepairableObject>().RecipeToDo[i] == RepairObject.COLLE) { image.sprite = resourceSprite[2].Sprite; } else if (pickableObject.GetComponent <RepairableObject>().RecipeToDo[i] == RepairObject.ENGRENAGE) { image.sprite = resourceSprite[3].Sprite; } else if (pickableObject.GetComponent <RepairableObject>().RecipeToDo[i] == RepairObject.FIL) { image.sprite = resourceSprite[4].Sprite; } } Debug.Log(pickableObject.GetComponent <RepairableObject>().RecipeToDo[0]); Debug.Log(pickableObject.GetComponent <RepairableObject>().RecipeToDo[1]); Debug.Log(pickableObject.GetComponent <RepairableObject>().RecipeToDo[2]); }
public void use() { if (heldPickable) { heldUsable = heldPickable.GetComponent <UsableObject> (); } else if (usables.Count > 0) { heldUsable = getFirstUsableObject(); } if (heldUsable) { if (heldUsable.objectLayer == UsableObject.LayerObject.Back) { levController.turnToBackground(); } else if (heldUsable.objectLayer == UsableObject.LayerObject.Front) { levController.turnToForeground(); } levController.OnCustomAnimationFinished += handleOnUseFinished; levController.playCustomAnimation(heldUsable.useAnimation); levController.stopMoving(); } }
public override bool Diposide(PickableObject pickableObject) { if (pickableObject.GetComponent <RepairableObject>()) { FMODUnity.RuntimeManager.PlayOneShot(pickableObject.eventdrop, transform.position); ownPickableObject = pickableObject; ownPickableObject.transform.SetParent(this.transform); return(true); } if (ownPickableObject != null && pickableObject.GetComponent <Resource>() != null) { ownPickableObject.GetComponent <RepairableObject>().checkRepair(pickableObject.GetComponent <Resource>().ResourcesData.RepairObject); Destroy(pickableObject.gameObject); return(true); } return(false); }