Пример #1
0
        void Start()
        {
            movementController = GetComponent <MovementController>();
            movementController.OnCoordinateSpaceDelta += OnCoordinateSpaceDelta;
            movementController.OnNewCoordinateSpace   += OnNewCoordinateSpace;

            var springObject = new GameObject("Axial");

            springObject.transform.parent        = transform;
            springObject.transform.localPosition = Vector3.zero;
            springObject.transform.localRotation = Quaternion.identity;

            var spring = springObject.AddComponent <AxialSpring>();

            spring.axis            = Vector3.up;
            spring.dynamicStrength = 0.00000001f;

            var gyroObject = new GameObject("Gyro");

            gyroObject.transform.parent        = springObject.transform;
            gyroObject.transform.localPosition = Vector3.zero;
            gyroObject.transform.localRotation = Quaternion.identity;

            var gyro = gyroObject.AddComponent <GyroSpring>();

            gyro.staticStrength = 10f;

            var camera = GetComponentInChildren <Camera>();

            camera.transform.parent        = gyroObject.transform;
            camera.transform.localPosition = Vector3.zero;
            camera.transform.localRotation = Quaternion.identity;

            root = SpringComponent.AutoLink(springObject);

            CEventSystem.AddEventListener(EventChannel.input, EventPlayerNumberChannel.player1, this);
        }
Пример #2
0
 private void Start()
 {
     movementController = GetComponent <MovementController>();
     movementController.OnGroundCollision += OnGroundCollisionHandler;
 }
Пример #3
0
 private void Awake()
 {
     movementController = GetComponent <MovementController>();
     CEventSystem.AddEventListener(EventChannel.input, playerNumber, movementController);
 }