示例#1
0
 public override void Init()
 {
     _body = Object.SearchComponent<RigidBody>();
     if (_body == null && ValidatePosition)
         throw new InvalidOperationException("No RigidBody found");
     base.Init();
 }
        public override void Init()
        {
            _body = Object.SearchComponent<RigidBody>();
            _collider = Object.SearchComponent<Collider>();

            base.Init();
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_deadBody != null)
         {
             _deadBody.Dispose();
             _deadBody = null;
         }
         if (_gravity != null)
         {
             _gravity.Dispose();
             _gravity = null;
         }
     }
     base.Dispose(disposing);
 }
            public AnimationController(GameObject deadObject, TimeSpan delay, float jumpForce)
            {
                _deadObject = deadObject;
                _delay = delay;
                _jumpForce = jumpForce;

                _deadBody = new RigidBody { Object = deadObject };
                _gravity = new Gravity { Object = _deadObject, RigidBody = _deadBody };
            }
 public override void Init()
 {
     RigidBody = RigidBody ?? Object.SearchComponent<RigidBody>();
     base.Init();
 }
示例#6
0
 public override void Init()
 {
     _rigidBody = Object.SearchComponent<RigidBody>();
     _targetBody = _target.SearchComponent<RigidBody>();
     base.Init();
 }
示例#7
0
        void SlideDown(Collider collider)
        {
            if (_state != State.Unused)
                return;

            collider.Object.Translate(new Vector3(GlobalTransform.TranslationVector.X - collider.Object.GlobalTransform.TranslationVector.X - 0.4f, 0, 0));

            _sliding = collider.Object;
            _slidingBody = collider.Object.SearchComponent<RigidBody>();
            TrackFlag();
            _sliding.Enabled = false;
            _flag.Transform = _flag.Transform * Matrix.RotationY((float)Math.PI);

            _delayCount = TimeSpan.Zero;
            _state = State.InitialDelay;
        }
示例#8
0
 void LoadBehaviors()
 {
     _rigidBody = new RigidBody { Friction = new Vector3(3f, 0, 0) };
     Add(_rigidBody);
     Add(new MainPlayerDeath());
     Add(new Gravity());
     Add(new Controller());
     Add(new LookForward());
     Add(new WalkToCastleAfterPoll());
     _blink = new Blink();
     Add(_blink);
 }