private void OnCollisionEnter(Collision other) { if (LayerMask.LayerToName(other.gameObject.layer) == "PlaceableSurface") { PlaceableSurface placeableSurface = other.collider.GetComponentInParent <PlaceableSurface>(); if (placeableSurface) { if (!placeableSurface.pickableObject && !rb.isKinematic) { placeableSurface.PlacePickableObject(this); } } } }
public virtual void DropItem(PlaceableSurface surface) { // should turn on physics and roll around if (surface) { transform.parent = surface.transform; transform.position = surface.positionOfItem.position; } else { transform.parent = null; itemInUse = false; } }
public override void DropItem(PlaceableSurface surface) { base.DropItem(surface); AttackableObject attackable = GetComponent <AttackableObject>(); if (attackable) { if (canBeUsedFor == UseType.CookedFood) { attackable.statFillValuesList.Clear(); attackable.statFillValuesList.Add(new StatTypeClass(StatType.Hunger, percentageFull, 0f)); attackable.statFillValuesList.Add(new StatTypeClass(StatType.Happiness, (percentageFull > 0.2f) ? 0.3f : -0.1f, 0f)); } attackable.RefreshAttackableObject(); } }
private void OnTriggerEnter(Collider other) { PickableItem item = other.GetComponent <PickableItem>(); PlaceableSurface placeableSurface = other.GetComponent <PlaceableSurface>(); SpawnableSurface spawnableSurface = other.GetComponent <SpawnableSurface>(); if (item && !ItemInHand) { itemAvailable = item; } if (placeableSurface) { placebaleSurfaceAvailable = placeableSurface; } if (spawnableSurface) { spawnableSurfaceAvailable = spawnableSurface; } }
public void Select() { if (selectedSurface != null) { selectedSurface.Hide(); } if (selectedChair != null) { selectedChair.UnSelectMeshes(); } if (selectedGenerator != null) { selectedGenerator.DeSelected(); } selectedGenerator = null; selectedSurface = null; groundObject = null; selectedChair = null; selectedDeliverer = null; RaycastHit hitInfo; if (Physics.Raycast(new Vector3(transform.position.x, height, transform.position.z), transform.forward, out hitInfo, interactRadius, layers)) { groundObject = hitInfo.collider.gameObject.GetComponent <Ingredient>(); if (!groundObject) { selectedChair = hitInfo.collider.gameObject.GetComponent <Chair>(); if (selectedChair) { selectedChair.SelectMeshes(); } else { selectedWigDispenser = hitInfo.collider.gameObject.GetComponent <WigDispenser>(); if (!selectedWigDispenser) { selectedGenerator = hitInfo.collider.gameObject.GetComponent <ObjectGenerator>(); if (selectedGenerator) { selectedGenerator.Selected(); } else { selectedDeliverer = hitInfo.collider.GetComponentInParent <RecipeDeliverer>(); if (!selectedDeliverer) { selectedSurface = hitInfo.collider.GetComponentInParent <PlaceableSurface>(); if (selectedSurface) { selectedSurface.Show(); } } } } } } } }