Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            if (_movementLocked == false)
            {
                SendMessage("Fly", new object[] { _direction });
            }

            if (_abilities != null)
            {
                _abilities.ResetAbilityState();
                _memory.CurrentPrimary = _abilities.ActivePrimary;
            }

            // Update AI memory sheet.
            _memory.Position = GameObject.Position;
            _memory.Velocity = _physics.GetVelocity();

            // Update possible enemies within the vision range. The behaviour tree will figure out the details.
            _memory.Enemies.Clear();
            var player = Pontification.SceneManagement.SceneInfo.Player;

            if ((player.Position - GameObject.Position).Length() <= _visionRange)
            {
                _memory.Enemies.Add(player);
            }

            // Update behaviour tree.
            //_movementLocked = false;
            _behaviourTree.Tick();
        }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            if (!_movementLocked)
            {
                SendMessage("Walk", new object[] { _direction });

                if (_wantToJump)
                {
                    SendMessage("Jump");
                    _wantToJump = false;
                }
            }

            if (_abilities != null)
            {
                _abilities.ResetAbilityState();
                _memory.CurrentPrimary = _abilities.ActivePrimary;
            }

            // Update AI memory sheet.
            _memory.Position = GameObject.Position;
            _memory.Velocity = _physics.Velocity;

            if (_memory.StandingJumpVelocity == Vector2.Zero)
            {
                _memory.StandingJumpVelocity = _physics.StandingJumpVelocity;
            }
            if (_memory.RunningJumpVelocity == Vector2.Zero)
            {
                _memory.RunningJumpVelocity = _physics.RunningJumpVelocity;
            }

            if (_physics != null)
            {
                _memory.Facing = _physics.Facing;
            }

            // Update possible enemies within the vision range. The behaviour tree will figure out the details.
            _memory.Enemies.Clear();
            if (SceneInfo.Player != null)
            {
                var playerStats = SceneInfo.Player.GetComponent <CharacterStats>();
                if ((SceneInfo.Player.Position - GameObject.Position).Length() < _visionRange &&
                    (playerStats != null && (playerStats.Category == CharacterCategory.CC_PRIEST || playerStats.Category == CharacterCategory.CC_GUARD)))
                {
                    _memory.Enemies.Add(SceneInfo.Player);
                }
            }


            // Update behaviour tree.
            _movementLocked = false;
            _behaviourTree.Tick();
        }
Ejemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            if (!_movementLocked)
            {
                SendMessage("Walk", new object[] { _direction });

                if (_wantToJump)
                {
                    SendMessage("Jump");
                    _wantToJump = false;
                }
            }

            if (_abilities != null)
            {
                _abilities.ResetAbilityState();
                _memory.CurrentPrimary = _abilities.ActivePrimary;
            }

            // Update AI memory sheet.
            _memory.Position = GameObject.Position;
            _memory.Velocity = _physics.Velocity;

            if (_memory.StandingJumpVelocity == Vector2.Zero)
            {
                _memory.StandingJumpVelocity = _physics.StandingJumpVelocity;
            }
            if (_memory.RunningJumpVelocity == Vector2.Zero)
            {
                _memory.RunningJumpVelocity = _physics.RunningJumpVelocity;
            }

            if (_physics != null)
            {
                _memory.Facing = _physics.Facing;
            }

            // Update possible enemies within the vision range. The behaviour tree will figure out the details.
            _memory.Enemies.Clear();
            Pontification.SceneManagement.SceneInfo.Spirits.ForEachWith(
                (spirit) => { _memory.Enemies.Add(spirit); },
                (spirit) => { return((spirit.Position - GameObject.Position).Length() <= _visionRange); });

            // Update behaviour tree.
            _movementLocked = false;
            _behaviourTree.Tick();
        }