示例#1
0
        public void UpdatePushBack()
        {
            int startSpeed = this.m_pushTime * this.m_pushTime / this.m_pushInitTime;
            int endSpeed   = this.m_pushInitTime - startSpeed;
            int pushBackX  = (startSpeed * this.m_pushBackStartPosition.m_x + endSpeed * this.m_pushBackEndPosition.m_x) / this.m_pushInitTime;
            int pushBackY  = (startSpeed * this.m_pushBackStartPosition.m_y + endSpeed * this.m_pushBackEndPosition.m_y) / this.m_pushInitTime;

            if (this.m_parent == null || this.m_parent.IsFlying() || this.m_parent.GetParent().GetLevel().GetTileMap().IsPassablePathFinder(pushBackX >> 8, pushBackY >> 8) ||
                this.m_ignorePush)
            {
                this.SetPosition(pushBackX, pushBackY);
            }
            else
            {
                this.m_pushBackStartPosition.m_x = this.m_position.m_x;
                this.m_pushBackStartPosition.m_y = this.m_position.m_y;
                this.m_pushBackEndPosition.m_x   = this.m_position.m_x;
                this.m_pushBackEndPosition.m_y   = this.m_position.m_y;
            }

            this.m_pushTime = LogicMath.Max(this.m_pushTime - 16, 0);

            if (this.m_pushTime == 0)
            {
                LogicGameObject      parent          = this.m_parent.GetParent();
                LogicCombatComponent combatComponent = parent.GetCombatComponent();

                if (parent.GetGameObjectType() == LogicGameObjectType.CHARACTER)
                {
                    LogicCharacter character = (LogicCharacter)parent;

                    if (character.GetCharacterData().GetPickNewTargetAfterPushback() || this.m_ignorePush)
                    {
                        if (combatComponent != null)
                        {
                            combatComponent.ForceNewTarget();
                        }
                    }
                }

                this.m_parent.NewTargetFound();

                if (combatComponent != null)
                {
                    combatComponent.StopAttack();
                }

                this.m_ignorePush = false;
            }
        }