예제 #1
0
        public List <string> CompareWith(PlayerGameItem that)
        {
            List <string> differents = ObjectUtil.CompareObjects(this, that);

            differents.AddRange(ObjectUtil.CompareObjects(this.Attrs, that.Attrs));
            if (CompareLists(this.Children, that.Children) != 0)
            {
                //Children are different
                differents.Add("Children");
            }
            if (CompareLists(this.Equipments, that.Equipments) != 0)
            {
                //Equipments are different
                differents.Add("Equipments");
            }
            List <string> differentsProps = this.ExtraProps.CompareWith(that.ExtraProps);

            if (differentsProps.Count > 0)
            {
                //Add the ExtraProps property name
                differents.Add("ExtraProps");
                //And add the difference inside ExtraProps
                differents.AddRange(differentsProps);
            }

            return(differents);
        }
예제 #2
0
 public async Task AddChild(PlayerGameItem child)
 {
     if (child != this)
     {
         //Avoid loop
         await PlayerGameItemService.Instance.AddChild(Id, child);
     }
     else
     {
         Debug.LogError("Cannot add self as child");
     }
 }