コード例 #1
0
    private GameObject DetachObject()
    {
        GameObject dropedObject = carried.gameObject;

        carried.Dropped();
        carried = null;
        return(dropedObject);
    }
コード例 #2
0
    public static Carried PickUpObject(GameObject toCarry, Transform toFollow, Vector2 offset)
    {
        Carried toRet = toCarry.AddComponent <Carried>();

        toRet.ObjectPickedUp();
        toRet.transform.SetParent(toFollow);
        toRet.transform.localPosition = offset;
        return(toRet);
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     levelManagement = FindObjectOfType <LevelManagement>();
     gaurdMovement   = FindObjectOfType <GaurdMovement>();
     FollowCursor    = FindObjectOfType <followCursor>();
     winLose         = FindObjectOfType <WinLoseScript>();
     carried         = FindObjectOfType <Carried>();
     speed           = moveSpeed;
 }
コード例 #4
0
ファイル: Carried.cs プロジェクト: lutherkaran/MovoLit
    public static Carried PickUpObject(GameObject toCarry, Transform toFollow)
    {
        Carried carried = toCarry.AddComponent <Carried>();

        carried.PickedUp();
        carried.transform.SetParent(toFollow);
        carried.transform.localPosition = new Vector2(.4f, .4f);
        carried.transform.localRotation = Quaternion.Euler(0, 0, 0);
        return(carried);
    }
コード例 #5
0
ファイル: Player.cs プロジェクト: mattstg/GoopSoupV2
 //Would be better if when we pickedup an object, we attached a  "carried" script to it, that way
 //reseting back to the proper values is easier
 private void PickupObject(GameObject toPickUp)
 {
     carryingObject = Carried.PickUpObject(toPickUp, transform, localHandPos);
     //toPickUp.transform.SetParent(transform);
     //toPickUp.transform.localPosition = localHandPos;
     //carryingObject = toPickUp;
     //Collider2D coli = toPickUp.GetComponent<Collider2D>();
     //Rigidbody2D rb = toPickUp.GetComponent<Rigidbody2D>();
     //if(coli) coli.enabled = false;
     //if (rb) rb.bodyType = RigidbodyType2D.Kinematic;
     //isCarrying = true;
 }
コード例 #6
0
ファイル: Player.cs プロジェクト: mattstg/GoopSoupV2
    //Would be better if there was an "attached" and "deattached" script on object, simpler to remove
    //and reset things back to original, here we assume the rigidbody should be dynamic... dangerous
    private GameObject DeattachCarryingItem()
    {
        //GameObject toRet = carryingObject;
        //Collider2D coli = toRet.GetComponent<Collider2D>();
        //Rigidbody2D rb = toRet.GetComponent<Rigidbody2D>();
        //if (coli) coli.enabled = true;
        //if (rb) rb.bodyType = RigidbodyType2D.Dynamic;
        //isCarrying = false;
        //carryingObject.transform.SetParent(null); //This is bad, what if it belonged to a parent group?
        //carryingObject = null;
        //return toRet;

        GameObject toRet = carryingObject.gameObject;

        carryingObject.ObjectDropped();
        carryingObject = null;
        return(toRet);
    }
コード例 #7
0
 public void UpdateSampleOwner(Carried carriedby)
 {
     this.CarriedBy = carriedby;
 }
コード例 #8
0
 private void PickupObject(GameObject go)
 {
     carried = Carried.PickUpObject(go, handTransform);
 }