Beispiel #1
0
        public Character(Vector2 position, string name, Genders gender = Genders.Male, Stats stats = null) : base(name, true, position, "ball")
        {
            this.gender = gender;

            CharStats = stats;

            if(CharStats == null)
            {
                CharStats = new Stats(1, 1, 1, 1);
            }

            Health = MaxHealth;

            armorRenderer = new Renderer(this);
            hairRenderer = new Renderer(this);

            Inventory = new Inventory(this);
        }
Beispiel #2
0
        public GameObject(string name, bool ignoreCollisions, Vector2 position, string spriteName, RendererOptions rendererOptions = null)
        {
            transform = new Transform(this);
            renderer = new Renderer(this);

            int cols = 1;
            int rows = 1;
            int index = 0;

            if (rendererOptions != null)
            {
                renderer.BlendColor = rendererOptions.color;
                cols = rendererOptions.cols;
                rows = rendererOptions.rows;
                index = rendererOptions.index;
            }

            renderer.SetTexture(spriteName, cols, rows);
            renderer.ImageIndex = index;

            this.IgnoreCollisions = ignoreCollisions;

            transform.Position = position;

            if (AllObjects == null)
                AllObjects = new List<GameObject>();

            if (NewObjects == null)
                NewObjects = new List<GameObject>();

            NewObjects.Add(this);

            this.spriteName = spriteName;
            this.Name = name;
        }