Exemplo n.º 1
0
        public override void SubTick()
        {
            base.SubTick();

            LogicCombatComponent   combatComponent   = this.GetCombatComponent();
            LogicMovementComponent movementComponent = this.GetMovementComponent();

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

            if (movementComponent != null)
            {
                movementComponent.SubTick();

                LogicMovementSystem movementSystem   = movementComponent.GetMovementSystem();
                LogicVector2        movementPosition = movementSystem.GetPosition();

                this.SetPositionXY(movementPosition.m_x, movementPosition.m_y);
            }
            else if (this.m_troopChild)
            {
                LogicVector2 tmp = new LogicVector2(this.m_troopChildX, this.m_troopChildY);

                tmp.Rotate(this.m_parent.GetDirection());

                LogicMovementSystem movementSystem = this.m_parent.GetMovementComponent().GetMovementSystem();
                LogicVector2        position       = movementSystem.GetPosition();

                this.SetPositionXY(tmp.m_x + position.m_x, tmp.m_y + position.m_y);
            }

            if (this.m_childrens != null)
            {
                for (int i = 0; i < this.m_childrens.Size(); i++)
                {
                    this.m_childrens[i].SubTick();
                }
            }

            int distanceX = this.GetX() + (this.GetWidthInTiles() << 8);
            int distanceY = this.GetY() + (this.GetHeightInTiles() << 8);

            if (this.m_auraSpell != null)
            {
                this.m_auraSpell.SetPositionXY(distanceX, distanceY);
            }

            if (this.m_abilitySpell != null)
            {
                this.m_abilitySpell.SetPositionXY(distanceX, distanceY);
            }

            if (this.m_retributionSpell != null)
            {
                this.m_retributionSpell.SetPositionXY(distanceX, distanceY);
            }
        }