// Token: 0x060000BD RID: 189 RVA: 0x00008198 File Offset: 0x00006398 public static GameObject BuildPrefab(string name, string guid, string defaultSpritePath, IntVector2 hitboxOffset, IntVector2 hitBoxSize) { bool flag = CompanionBuilder.companionDictionary.ContainsKey(guid); GameObject result; if (flag) { ETGModConsole.Log("CompanionBuilder: Tried to create two companion prefabs with the same GUID!", false); result = null; } else { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(CompanionBuilder.behaviorSpeculatorPrefab); gameObject.name = name; tk2dSprite component = SpriteBuilder.SpriteFromResource(defaultSpritePath, gameObject).GetComponent <tk2dSprite>(); component.SetUpSpeculativeRigidbody(hitboxOffset, hitBoxSize).CollideWithOthers = false; gameObject.AddComponent <tk2dSpriteAnimator>(); gameObject.AddComponent <AIAnimator>(); HealthHaver healthHaver = gameObject.AddComponent <HealthHaver>(); healthHaver.RegisterBodySprite(component, false, 0); healthHaver.PreventAllDamage = true; healthHaver.SetHealthMaximum(15000f, null, false); healthHaver.FullHeal(); AIActor aiactor = gameObject.AddComponent <AIActor>(); aiactor.State = AIActor.ActorState.Normal; aiactor.EnemyGuid = guid; BehaviorSpeculator component2 = gameObject.GetComponent <BehaviorSpeculator>(); component2.MovementBehaviors = new List <MovementBehaviorBase>(); component2.AttackBehaviors = new List <AttackBehaviorBase>(); component2.TargetBehaviors = new List <TargetBehaviorBase>(); component2.OverrideBehaviors = new List <OverrideBehaviorBase>(); component2.OtherBehaviors = new List <BehaviorBase>(); EnemyDatabaseEntry item = new EnemyDatabaseEntry { myGuid = guid, placeableWidth = 2, placeableHeight = 2, isNormalEnemy = false }; EnemyDatabase.Instance.Entries.Add(item); CompanionBuilder.companionDictionary.Add(guid, gameObject); UnityEngine.Object.DontDestroyOnLoad(gameObject); FakePrefab.MarkAsFakePrefab(gameObject); gameObject.SetActive(false); result = gameObject; } return(result); }