Exemple #1
0
    public Adherent attach(Resource res) {
        follower.swapSprite();
        isCarrying = true;
        res.clearIntersectionAdherents();

        res.gameObject.transform.SetParent(follower.host.transform);
        res.gameObject.transform.localPosition = new Vector3(0, 0, 0);
        res.gameObject.transform.localEulerAngles = new Vector3(1, 0, 0);
        res.pauseCollision();
        return this;
    }
Exemple #2
0
    public void detach(Resource res, bool andPauseCollision) {
        follower.swapSprite();
        isCarrying = false;

        res.gameObject.transform.SetParent(null);
        res.gameObject.transform.localPosition = follower.gameObject.transform.position;
        res.gameObject.transform.localEulerAngles = follower.gameObject.transform.localEulerAngles;
        res.parent = null;

        if (andPauseCollision) {
            res.pauseCollision();
        }
    }