Ejemplo n.º 1
0
        public static StatBlock CreateInstance(StatBlock template, params int[] values)
        {
            StatBlock instance = Instantiate(template);

            if (values.Length != 0 && values.Length != instance.Stats.Length)
            {
                throw new ArgumentException(string.Format("Initial stat values mismatch: expected {0}, found {1}",
                                                          instance.Stats.Length,
                                                          values.Length));
            }

            for (int i = 0; i < instance.Stats.Length; i++)
            {
                instance.Stats[i] = Instantiate(instance.Stats[i]);
                if (i < values.Length)
                {
                    instance.Stats[i].SetBaseValue(values[i]);
                }
            }

            foreach (Stat stat in instance.Stats)
            {
                instance._statsDict[stat.statName] = stat;
            }

            return(instance);
        }
Ejemplo n.º 2
0
 public SimpleActor(StatBlock stats)
 {
     visibleTiles = new List <RLBaseTile>();
     _stats       = stats;
     _inventory   = new List <RLBaseItem>();
 }
Ejemplo n.º 3
0
 public void BindStatBlock(Stat stat, StatBlock block)
 {
     block.OnStatsChanged += (statBlock => BindData(stat));
     BindData(stat);
 }
Ejemplo n.º 4
0
 public void BindStatBlock(StatBlock statBlock)
 {
     _statBlock = statBlock;
     BindDataList(new List <Stat>(statBlock.Stats));
 }