Пример #1
0
        /// <summary>
        ///     Sets the gameobject position.
        /// </summary>
        public void SetPositionXY(int x, int y)
        {
            if (this._position.X != x || this._position.Y != y)
            {
                int oldX = this.GetTileX();
                int oldY = this.GetTileY();

                this._position.Set(x, y);

                if (this._components[13] != null)
                {
                    LogicLayoutComponent layoutComponent = (LogicLayoutComponent)this._components[13];

                    if (layoutComponent.IsEnabled())
                    {
                        if (this._level != null)
                        {
                            layoutComponent.SetPositionLayout(this._level.GetActiveLayout(), x >> 9, y >> 9);
                        }
                    }
                }

                if (this._globalId != -1)
                {
                    this._level.GetTileMap().GameObjectMoved(this, oldX, oldY);
                }
            }
        }
Пример #2
0
        /// <summary>
        ///     Sets the initial position.
        /// </summary>
        public virtual void SetInitialPosition(int x, int y)
        {
            this._position.Set(x, y);

            if (this._components[13] != null)
            {
                LogicLayoutComponent layoutComponent = (LogicLayoutComponent)this._components[13];

                if (layoutComponent.IsEnabled())
                {
                    if (this._level != null)
                    {
                        layoutComponent.SetPositionLayout(this._level.GetActiveLayout(), x >> 9, y >> 9);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        ///     Sets the gameobject position in layout.
        /// </summary>
        public void SetPositionLayoutXY(int tileX, int tileY, int activeLayout, bool editMode)
        {
            if (this._components[13] != null)
            {
                LogicLayoutComponent layoutComponent = (LogicLayoutComponent)this._components[13];

                if (layoutComponent.IsEnabled())
                {
                    if (editMode)
                    {
                        layoutComponent.SetEditModePositionLayout(activeLayout, tileX, tileY);
                    }
                    else
                    {
                        layoutComponent.SetPositionLayout(activeLayout, tileX, tileY);
                    }
                }
            }
        }