示例#1
0
        /// <summary>
        /// Called when the owner is registered
        /// </summary>
        protected override bool _OnRegister(TorqueObject owner)
        {
            if (!base._OnRegister(owner) || !(owner is T2DSceneObject))
                return false;

            // todo: perform initialization for the component

            // todo: look up interfaces exposed by other components
            // E.g.,
            // _theirInterface =
            //      Owner.Components.GetInterface<ValueInterface<float>>(
            //          "float", "their interface name");

            BotComponent bot =
                SceneObject.Components.FindComponent<BotComponent>();
            if (bot == null)
            {
                return false;
            }

            _goalRegulator = new Regulator(UpdatesPerSec, UpdatePeriodVariator);

            //_goal = new Think(bot);

            // activate tick callback for this component.
            ProcessList.Instance.AddTickCallback(Owner, this);

            return true;
        }
示例#2
0
        /// <summary>
        /// Called when the owner is registered
        /// </summary>
        protected override bool _OnRegister(TorqueObject owner)
        {
            if (!base._OnRegister(owner) || !(owner is T2DSceneObject))
                return false;

            // todo: perform initialization for the component

            // todo: look up interfaces exposed by other components
            // E.g.,
            // _theirInterface =
            //      Owner.Components.GetInterface<ValueInterface<float>>(
            //          "float", "their interface name");

            // activate tick callback for this component.
            ProcessList.Instance.AddTickCallback(Owner, this);

            _thrustEvent = new TorqueEvent<ThrustData>("thrustEvent");

            _steeringRegulator = new Regulator(UpdatesPerSec);

            _maxForwardSpeed =
                Owner.Components.GetInterface<ValueInterface<float>>(
                    "float", "maxForwardSpeed");
            _maxReverseSpeed =
                Owner.Components.GetInterface<ValueInterface<float>>(
                    "float", "maxReverseSpeed");
            _maxBrakingDeceleration =
                Owner.Components.GetInterface<ValueInterface<float>>(
                    "float", "maxBrakingDeceleration");

            return true;
        }