Example #1
0
        public Field(Vector2i coords, TraversibilityData traversabilityData, bool rotatable, Texture texture, string type, GameObject gameObject) : base(new Vector2f(coords.X * 64, coords.Y * 64), new Vector2f(64, 64))
        {
            Coords             = coords;
            TraversabilityData = traversabilityData;
            Texture            = texture;
            Type    = type;
            Surface = new SpriteComponent(Position, Size, texture, new Color(255, 255, 255, 255));
            if (rotatable)
            {
                Surface.SetDirection(GamestateManager.Instance.Random.Next(1, 5) * 90);
            }
            GameObject = gameObject;
            if (gameObject != null)
            {
                GameObject.Field = this;
            }

            RenderLayer = RenderLayer.Field;
            RenderView  = RenderView.Game;
        }