public static ColliderEnablingController AddController(IEnumerable <Collider> colliders, object key, bool off)
    {
        var controller = new ColliderEnablingController(colliders, off);

        if (!controllers.Keys.Any(k => k == key))
        {
            controllers.Add(key, controller);
        }
        else
        {
            controllers[key] = controller;
        }

        return(controller);
    }
Esempio n. 2
0
    public void GetOn(GameObject player)
    {
        _player = player;
        player.transform.SetParent(transform);
        player.transform.localPosition = Vector3.zero;
        player.GetComponent <Rigidbody>().isKinematic = true;
        PlayerController controller = player.GetComponent <PlayerController>();

        controller.GetKeys(out goForward, out goBack, out goLeft, out goRight, out run, out jump);
        controller.SetBlock(false);
        player.transform.localRotation     = new Quaternion(0, 0, 0, 0);
        colliderController                 = new ColliderEnablingController(player, true);
        controller.camScript.camController = new CartCameraController(controller.camScript);
        enabled = true;
    }
Esempio n. 3
0
    public void GetOff()
    {
        _player.transform.SetParent(null);
        _player.transform.position = LandingPose;
        _player.GetComponent <PlayerController>().SetBlock(true);
        _player.GetComponent <Rigidbody>().isKinematic = false;
        var camScr = _player.GetComponent <PlayerCameraScript>();

        camScr.camController = new StandartCameraController(camScr, 0, Quaternion.LookRotation(LandingPose - transform.position).eulerAngles.y);
        enabled = false;

        if (colliderController != null)
        {
            colliderController.EnableColliders();
            colliderController = null;
        }
    }