コード例 #1
0
ファイル: Character.cs プロジェクト: Master2112/Roguelike
        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);
        }
コード例 #2
0
ファイル: GameObject.cs プロジェクト: Master2112/Roguelike
        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;
        }