Example #1
0
 public Floater(CustomCritter critter)
     : base(critter.startingPosition)
 {
     this.data             = critter.data;
     this.sprite           = critter.sprite;
     this.position         = critter.startingPosition;
     this.startingPosition = this.position;
     this.baseFrame        = this.sprite.currentFrame;
     if (critter.data.Behavior.NumFrames == 4)
     {
         this.summerButterfly = true;
     }
     this.sprite.loop = false;
 }
Example #2
0
        public virtual Critter makeCritter(Vector2 tile)
        {
            // absolute position
            var           position = tile * Game1.tileSize;
            CustomCritter critter  = new CustomCritter(position, this);

            if (Classification == "Floater")
            {
                return(new Floater(critter));
            }
            else if (Classification == "Crawler")
            {
                return(new Crawler(position, this));
            }
            else
            {
                return(new Crawler(position, this));
            }
        }
Example #3
0
        public static BugModel createBugModelFromCritter(Critter critter)
        {
            string bugName = critter.GetType().ToString().Split('.').Last();

            if (AllKnownClassifications.Contains(bugName))
            {
                BugModel bugModel = new BugModel();
                if (bugName == "Floater")
                {
                    Floater f = (Floater)critter;
                    bugModel = AllBugs.Find(b => b.FullId == f.data.BugModel.FullId);
                }
                else
                {
                    CustomCritter c = (CustomCritter)critter;
                    bugModel = AllBugs.Find(b => b.FullId == c.data.BugModel.FullId);
                }
                return(bugModel);
            }

            int TileIndex = Helper.Reflection.GetField <int>(critter, "baseFrame").GetValue();

            return(createPlainBugModel(bugName, TileIndex));
        }