예제 #1
0
        protected override void SimpleInit()
        {
            if (!ObjectPrivate.TryGetFirstComponent <RigidBodyComponent>(out rigidBody))
            {
                Log.Write(LogLevel.Error, __SimpleTag, "SimpleSitStand must be attached to an object with a RigidBodyComponent");
                return;
            }

            SitObjectInfo[] sitPoints = rigidBody.GetSitObjectInfo();
            if (sitPoints.Length == 0)
            {
                Log.Write(LogLevel.Warning, __SimpleTag, "SimpleSitStand must be attached to an object with at least one sit point to be useful!");
                return;
            }

            if (StartEnabled)
            {
                Subscribe(null);
            }

            SubscribeToAll(EnableEvent, Subscribe);
            SubscribeToAll(DisableEvent, Unsubscribe);
        }