コード例 #1
0
ファイル: GameObj.cs プロジェクト: MFHabibie/UnityProjects
    /// <summary>
    /// Method is triggered by "Grab" or similar method from current state of HandType
    /// </summary>
    /// <returns>new Leapstate or null to remain in current state</returns>
    public virtual State Activate(BaseTypeHnd h)
    {
        if (!owner)
        {
            owner = h;
        }

        return(new GodHand(this));
    }
コード例 #2
0
    public override void Enter(BaseTypeHnd o)
    {
        handController = o;
        if (activeObj)
        {
            handController.SetActiveObject(activeObj);

            if (!activeObj.handIsVisible)
            {
                handController.HideHand();
            }
        }
    }
コード例 #3
0
ファイル: GameObj.cs プロジェクト: MFHabibie/UnityProjects
    public virtual void UpdateTransform(BaseTypeHnd t)
    {
        Vector3    grabOffsetPos = new Vector3();
        Quaternion grabOffsetRot = Quaternion.identity;

        if (grabCenterOffset)
        {
            grabOffsetPos = grabCenterOffset.transform.position - transform.position;
            grabOffsetRot = grabCenterOffset.localRotation;
        }

        transform.position  = t.transform.position - grabOffsetPos;
        transform.rotation  = t.transform.rotation;
        transform.rotation *= grabOffsetRot;
    }
コード例 #4
0
ファイル: UniHand.cs プロジェクト: MFHabibie/UnityProjects
	void Start () 
	{
		handType = (BaseTypeHnd)Instantiate(handType, transform.position, Quaternion.identity);
		handType.SetOwner(this);
		handType.name = isRightHand ? "rightHand" : "leftHand";
		
		GetComponent<Renderer>().enabled = false; // Disable visual indicator for Unityhand
		
		if (initialLeapObject)
		{
			initialLeapObject.gameObject.SetActive(true);
			handType.ChangeState(initialLeapObject.Activate(handType));
		}
		
		originalPos = transform.localPosition;

	}
コード例 #5
0
ファイル: GameObj.cs プロジェクト: MFHabibie/UnityProjects
    public virtual State Release(BaseTypeHnd h)
    {
        if (!isStatePersistent)
        {
            if (h && h.activeObj)
            {
                h.activeObj = null;
            }
            else
            {
                owner.activeObj = null;
            }

            owner = null;
            return(new GodHand());            // each object should return a state
        }
        return(null);
    }
コード例 #6
0
ファイル: NoHand.cs プロジェクト: MFHabibie/UnityProjects
 public override void Enter(BaseTypeHnd o)
 {
     handController = o;
     handController.HideHand();
 }