public override void Use(GrabbableObject bp) { if (bp.GetType() == (typeof(BodyPart)) || bp.GetType().IsSubclassOf(typeof(BodyPart))) { bp.AsBodyPart().Harvest(); } }
public override void Use(GrabbableObject g) { if (g.GetType() == typeof(Blender)) { player.DropHolding(false); ((Blender)g).Use(this); Debug.Log("VVVRRRRRRRR"); } }
void MouseHandler() { cursor.gameObject.SetActive(true); var wp = (Camera.main.ScreenToWorldPoint(Input.mousePosition)); cursor.transform.position = Vector3Int.RoundToInt(new Vector3(wp.x, wp.y, cZ)); if (Input.GetMouseButtonDown(0)) { Ray r = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(wp, Vector2.zero); if (Holding != null && Holding.UseOnMap) { if (hit.transform != null) { Holding.Use(hit.transform.GetComponent <GrabbableObject>()); } if (Holding != null) { Holding.Use(wp); } } else { //first raycast under mouse to see if we are clicking on the map, or something collidable if (hit.transform != null) { if (hit.transform.CompareTag("Object")) { var g = hit.transform.GetComponent <GrabbableObject>(); if (Holding != null && !Holding.UseOnMap) { Holding.Use(g); } else if (g.Pickup()) { Holding = g; } } else if (hit.transform.CompareTag("Vendor")) { hit.transform.GetComponent <LimbVendor>().Open(); } } else { } } } if (Input.GetMouseButtonDown(1)) { DropHolding(); } }
public void AddToHand(GrabbableObject o) { if (Holding != null) { Holding.Drop(movement); } Holding = o; o.Pickup(); }
public void DropHolding(bool tellObject = true) { if (Holding != null) { if (tellObject) { Holding.Drop(movement); } } Holding = null; }
public override void Use(GrabbableObject o) { if (!o.GetType().IsSubclassOf(typeof(BodyPart)) || ((BodyPart)o).IsPlanted || currentValue == maxValue) { return; } sfx.PlayAudio(sfx.Blend); currentValue = currentValue.AddClamped(o.AsBodyPart().Value, 0f, maxValue); RefreshBlenderFill(); Destroy(o.gameObject); }
public virtual void Use(GrabbableObject g) { }