private void Update()
    {
        Capstan cap = capstan.GetComponent <Capstan>();

        targetAngle = ((float)(cap.actualAngle - cap.maxAngle) / (float)cap.maxAngle) * 50.0f * -1.0f;

        //moves the bridge in function of the desired angle
        if ((int)actualAngle != (int)targetAngle)
        {
            int sign = targetAngle > actualAngle ? 1 : -1;
            transform.localEulerAngles = new Vector3(0, transform.localEulerAngles.y, actualAngle += (cap.rotationSpeed * sign));
        }


        if (actualAngle == 0 && !crossableBridge)
        {
            invisibleWall.SetActive(false);
            crossableBridge = true;
        }
        else if (actualAngle != 0 && crossableBridge)
        {
            invisibleWall.SetActive(true);
            crossableBridge = false;
        }
    }
Example #2
0
        private static void Setup()
        {
            capstan =
                Builder <StringMessage, string> .New()
                .AddRoute("Error", (input, dependencies) => new ErrorEvent(input))
                .AddRoute("ReturnToMe", (input, dependencies) => new BounceEvent(input))
                .AddRoute("TellAll", (input, dependencies) => new ToAllEvent(input))
                .AddRoute("TellOthers", (input, dependencies) => new TellOthersEvent(input))
                .AddRoute("Void", (input, dependencies) => new VoidEvent(input))
                .AddRoute("TellMeMuch", (input, dependencies) => new ChattyEventFactory().Create(input, dependencies)) //Create an instance of the factory, or use static method Create.
                .RegisterDependencies(container =>
            {
                //Remember: using Unity;
                container.RegisterType <IEnterpriseBusinessDependency, EnterpriseBusinessDependency>(new TransientLifetimeManager());
            })
                .RegisterActivist((dependencies) => new PeoplePoker <StringMessage, string>()) //Register Activist that pokes random person on a timer
                .SetBroadcaster(dependencies => new Broadcaster <StringMessage, string>())
                .SetErrorManager(dependencies => new FeaturedErrorManager())
                .Build();

            capstan.Subscribe(new LoggerClient(1337, "Logger"));
        }