Esempio n. 1
0
    private void DropHeldObject()
    {
        AnchorPoint CurrAnchorPoint = anchorPoint;

        if (CurrAnchorPoint)
        {
            if (!CurrAnchorPoint.IsOccupied && CurrAnchorPoint.canObjectBePlacedHere(heldObject.TheHeldObject) /*&& !heldObject.TheHeldObject.GetComponent<BaseObject>().isColliding*/)
            {
                if (heldObject.TheHeldObject.GetComponent <WWisePlaceTrigger>())
                {
                    heldObject.TheHeldObject.GetComponent <WWisePlaceTrigger>().Place();
                }
                else
                {
                    print("Warning: WWISE not attatched to " + heldObject.TheHeldObject.name);
                }

                SetLayerRecursive(heldObject.TheHeldObject.transform.parent.gameObject, (int)BaseObject.Layers.Default);

                // for stabber
                StabberComponent stabber;
                if (stabber = heldObject.TheHeldObject.GetComponent <StabberComponent>())
                {
                    if (CurrAnchorPoint.Equals(stabber.DetectLodgeTarget()))
                    {
                        stabber.Lodge();
                    }
                }

                heldObject.TheHeldObject.GetComponent <BaseObject>().isHeld = false;
                heldObject.PlaceObject(CurrAnchorPoint.gameObject);
                previousObject = null;
                HideAllStackableObjects();
                objectisHeld = false;
                prevCanPlace = null;
                ChangeCursor(true);
            }
        }
    }
Esempio n. 2
0
    // to be discarded
    private void Stab()
    {
        StabberComponent stabber;

        if (stabber = heldObject.TheHeldObject.GetComponent <StabberComponent>())
        {
            RaycastHit hit;
            Ray        ray = GetComponent <Camera>().ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 10000))
            {
                GameObject  target          = hit.transform.gameObject;
                AnchorPoint CurrAnchorPoint = target.GetComponent <AnchorPoint>();
                if (CurrAnchorPoint)
                {
                    if (!CurrAnchorPoint.IsOccupied && CurrAnchorPoint.canObjectBePlacedHere(heldObject.TheHeldObject) && CurrAnchorPoint.Equals(stabber.DetectLodgeTarget()))
                    {
                        heldObject.TheHeldObject.GetComponent <BaseObject>().isHeld = false;
                        stabber.Lodge();
                        heldObject.PlaceObject(target);
                        previousObject = null;
                    }
                }
            }
        }
    }