Exemple #1
0
    /// <summary>
    /// Creation of a JoyObject (MonoBehaviour) using a List of Sprites
    /// </summary>
    /// <param name="name"></param>
    /// <param name="hitPoints"></param>
    /// <param name="position"></param>
    /// <param name="sprites"></param>
    /// <param name="baseType"></param>
    /// <param name="isAnimated"></param>
    /// <param name="isWall"></param>
    public JoyObject(string name, int hitPoints, Vector2Int position, List <Sprite> sprites, string baseType, bool isAnimated, bool isWall = false, bool isDestructible = true)
    {
        this.JoyName = name;
        this.GUID    = GUIDManager.AssignGUID();

        this.m_HitPoints = hitPoints;

        this.m_WorldPosition = position;
        this.Move(this.m_WorldPosition);

        this.m_Icons = sprites.ToArray();

        this.BaseType       = baseType;
        this.IsAnimated     = isAnimated;
        this.IsWall         = isWall;
        this.IsDestructible = isDestructible;

        //If it's not animated, select a random icon to represent it
        if (!this.IsAnimated && sprites != null)
        {
            this.ChosenIcon = RNG.Roll(0, sprites.Count - 1);
        }
        else
        {
            this.ChosenIcon = 0;
        }

        this.m_LastIcon = 0;
        this.m_FramesSinceLastChange = 0;
    }
Exemple #2
0
        public ItemInstance(ItemInstance item) :
            base(item.ItemType.UnidentifiedName, item.ItemType.GetHitPoints(), item.WorldPosition, item.Icons, item.BaseType, item.IsAnimated, false, false)
        {
            this.m_Type = item.ItemType;
            this.Move(item.WorldPosition);

            this.m_HitPoints          = item.ItemType.GetHitPoints();
            this.m_HitPointsRemaining = this.m_HitPoints;
            this.GUID       = GUIDManager.AssignGUID();
            this.Identified = item.Identified;

            this.m_Contents = item.m_Contents;

            m_InteractionFile = item.m_InteractionFile;
        }
Exemple #3
0
        public ItemInstance(BaseItemType type, Vector2Int position, bool identified, string interactionFile = null) :
            base(type.UnidentifiedName, type.GetHitPoints(), position, ObjectIcons.GetSprites(type.Category, type.UnidentifiedName), type.Category, false)
        {
            this.m_Type = type;
            this.Move(position);

            this.m_HitPoints          = type.GetHitPoints();
            this.m_HitPointsRemaining = this.m_HitPoints;
            this.GUID       = GUIDManager.AssignGUID();
            this.Identified = identified;
            //chosenIcon = RNG.Roll(0, m_Icons.Length - 1);

            this.m_Contents = new List <long>();

            m_InteractionFile = interactionFile;
        }
Exemple #4
0
        /// <summary>
        /// For creating a well-established WorldInstance
        /// </summary>
        /// <param name="tiles"></param>
        /// <param name="areas"></param>
        /// <param name="entities"></param>
        /// <param name="objects"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        public WorldInstance(WorldTile[,] tiles, Dictionary <Vector2Int, WorldInstance> areas, List <Entity> entities,
                             List <JoyObject> objects, Dictionary <Vector2Int, JoyObject> walls, WorldType type, string name)
        {
            this.Name    = name;
            this.m_Type  = type;
            m_Tiles      = tiles;
            m_Areas      = areas;
            m_Entities   = entities;
            m_Objects    = objects;
            m_Walls      = walls;
            GUID         = GUIDManager.AssignGUID();
            m_Discovered = new bool[m_Tiles.GetLength(0), m_Tiles.GetLength(1)];
            CalculatePlayerIndex();
            m_Light = new int[m_Tiles.GetLength(0), m_Tiles.GetLength(1)];

            m_FogOfWarHolder = GameObject.Find("WorldFog");
            m_WallHolder     = GameObject.Find("WorldWalls");
            m_ObjectHolder   = GameObject.Find("WorldObjects");
            m_EntityHolder   = GameObject.Find("WorldEntities");
        }
Exemple #5
0
        /// <summary>
        /// A template for adding stuff to later. A blank WorldInstance.
        /// </summary>
        /// <param name="tiles"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        public WorldInstance(WorldTile[,] tiles, WorldType type, string name)
        {
            m_Dimensions = new Vector2Int(tiles.GetLength(0), tiles.GetLength(1));

            this.Name    = name;
            this.m_Type  = type;
            m_Tiles      = tiles;
            m_Areas      = new Dictionary <Vector2Int, WorldInstance>();
            m_Entities   = new List <Entity>();
            m_Objects    = new List <JoyObject>();
            m_Walls      = new Dictionary <Vector2Int, JoyObject>();
            GUID         = GUIDManager.AssignGUID();
            m_Discovered = new bool[m_Tiles.GetLength(0), m_Tiles.GetLength(1)];
            m_Light      = new int[m_Tiles.GetLength(0), m_Tiles.GetLength(1)];

            m_FogOfWarHolder = GameObject.Find("WorldFog");
            m_WallHolder     = GameObject.Find("WorldWalls");
            m_ObjectHolder   = GameObject.Find("WorldObjects");
            m_EntityHolder   = GameObject.Find("WorldEntities");
        }