示例#1
0
 public override void Use(GrabbableObject bp)
 {
     if (bp.GetType() == (typeof(BodyPart)) || bp.GetType().IsSubclassOf(typeof(BodyPart)))
     {
         bp.AsBodyPart().Harvest();
     }
 }
示例#2
0
 public override void Use(GrabbableObject g)
 {
     if (g.GetType() == typeof(Blender))
     {
         player.DropHolding(false);
         ((Blender)g).Use(this);
         Debug.Log("VVVRRRRRRRR");
     }
 }
示例#3
0
        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();
            }
        }
示例#4
0
        public void AddToHand(GrabbableObject o)
        {
            if (Holding != null)
            {
                Holding.Drop(movement);
            }

            Holding = o;
            o.Pickup();
        }
示例#5
0
 public void DropHolding(bool tellObject = true)
 {
     if (Holding != null)
     {
         if (tellObject)
         {
             Holding.Drop(movement);
         }
     }
     Holding = null;
 }
示例#6
0
 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);
 }
示例#7
0
 public virtual void Use(GrabbableObject g)
 {
 }