Пример #1
0
    public void SetPossessed(Possesable target)
    {
        if (possesing != null)
        {
            possesing.isPossessed = false;
        }
        target.isPossessed = true;
        possesing          = target;

        //Spawn possess target
        if (target.GetComponent <CameraController>() == null)  //if not camera
        {
            possessCursor = Instantiate(Resources.Load("possessCursor") as GameObject);
            possessCursor.GetComponent <CursorBob>().following = possesing.transform;
        }
        else if (possessCursor != null)     //otherwise if we are possessing the camera, destroy the cursor
        {
            Destroy(possessCursor);
            possessCursor = null;
        }
    }