public static void BuildPrefab() { bool flag = BabyGoodDet.prefab != null || CompanionBuilder.companionDictionary.ContainsKey(BabyGoodDet.guid); if (!flag) { BabyGoodDet.prefab = CompanionBuilder.BuildPrefab("Baby Good Det", BabyGoodDet.guid, "NevernamedsItems/Resources/Companions/BabyGoodDet/babygooddet_idle_001", new IntVector2(5, 3), new IntVector2(9, 8)); var companionController = BabyGoodDet.prefab.AddComponent <BabyDetBehav>(); companionController.aiActor.MovementSpeed = 5f; companionController.CanCrossPits = true; companionController.aiActor.SetIsFlying(true, "Flying Entity", false, true); companionController.aiActor.ActorShadowOffset = new Vector3(0, -0.5f); BabyGoodDet.prefab.AddAnimation("flight", "NevernamedsItems/Resources/Companions/BabyGoodDet/babygooddet_idle", 7, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.Single, DirectionalAnimation.FlipType.None); BabyGoodDet.prefab.AddAnimation("idle", "NevernamedsItems/Resources/Companions/BabyGoodDet/babygooddet_idle", 7, CompanionBuilder.AnimationType.Flight, DirectionalAnimation.DirectionType.Single, DirectionalAnimation.FlipType.None); BabyGoodDet.prefab.AddAnimation("attack", "NevernamedsItems/Resources/Companions/BabyGoodDet/babygooddet_attack", 6, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.Single, DirectionalAnimation.FlipType.None); BabyGoodDet.prefab.AddAnimation("contattack", "NevernamedsItems/Resources/Companions/BabyGoodDet/babygooddet_contattack", 6, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.Single, DirectionalAnimation.FlipType.None); companionController.aiAnimator.GetDirectionalAnimation("idle").Prefix = "idle"; prefab.GetComponent <tk2dSpriteAnimator>().GetClipByName("attack").wrapMode = tk2dSpriteAnimationClip.WrapMode.Once; prefab.GetComponent <tk2dSpriteAnimator>().GetClipByName("contattack").wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop; BehaviorSpeculator component = BabyGoodDet.prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 5f; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" } }); } }
public static void BuildPrefab() { bool flag = Diode.prefab != null || CompanionBuilder.companionDictionary.ContainsKey(Diode.guid); if (!flag) { Diode.prefab = CompanionBuilder.BuildPrefab("Diode Companion", Diode.guid, "NevernamedsItems/Resources/Companions/Diode/diode_idle_001", new IntVector2(4, 0), new IntVector2(8, 8)); var companionController = Diode.prefab.AddComponent <DiodeCompanionBehaviour>(); prefab.AddAnimation("idle_left", "NevernamedsItems/Resources/Companions/Diode/diode_idle", 7, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal, DirectionalAnimation.FlipType.None); prefab.AddAnimation("idle_right", "NevernamedsItems/Resources/Companions/Diode/diode_idle", 7, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal, DirectionalAnimation.FlipType.None); prefab.AddAnimation("run_left", "NevernamedsItems/Resources/Companions/Diode/diode_moveright", 12, CompanionBuilder.AnimationType.Move, DirectionalAnimation.DirectionType.TwoWayHorizontal, DirectionalAnimation.FlipType.None); prefab.AddAnimation("run_right", "NevernamedsItems/Resources/Companions/Diode/diode_moveleft", 12, CompanionBuilder.AnimationType.Move, DirectionalAnimation.DirectionType.TwoWayHorizontal, DirectionalAnimation.FlipType.None); companionController.aiAnimator.GetDirectionalAnimation("idle").Prefix = "idle"; companionController.aiAnimator.GetDirectionalAnimation("move").Prefix = "run"; companionController.CanInterceptBullets = false; companionController.companionID = CompanionController.CompanionIdentifier.NONE; companionController.aiActor.MovementSpeed = 7f; companionController.aiActor.healthHaver.PreventAllDamage = true; companionController.aiActor.CollisionDamage = 0f; companionController.aiActor.specRigidbody.CollideWithOthers = false; companionController.aiActor.specRigidbody.CollideWithTileMap = false; BehaviorSpeculator component = Diode.prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 2; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" } }); } }
public static void BuildPrefab() { bool flag = Gusty.prefab != null || CompanionBuilder.companionDictionary.ContainsKey(Gusty.guid); if (!flag) { Gusty.prefab = CompanionBuilder.BuildPrefab("Gusty", Gusty.guid, "NevernamedsItems/Resources/Companions/Gusty/gusty_idle_001", new IntVector2(5, 3), new IntVector2(11, 11)); var companionController = Gusty.prefab.AddComponent <GustyBehav>(); companionController.aiActor.MovementSpeed = 5f; companionController.CanCrossPits = true; companionController.aiActor.ActorShadowOffset = new Vector3(0, -0.5f); Gusty.prefab.AddAnimation("flight", "NevernamedsItems/Resources/Companions/Gusty/gusty_idle", 7, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.Single, DirectionalAnimation.FlipType.None); Gusty.prefab.AddAnimation("idle", "NevernamedsItems/Resources/Companions/Gusty/gusty_idle", 7, CompanionBuilder.AnimationType.Flight, DirectionalAnimation.DirectionType.Single, DirectionalAnimation.FlipType.None); Gusty.prefab.AddAnimation("attack", "NevernamedsItems/Resources/Companions/Gusty/gusty_attack", 14, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.Single, DirectionalAnimation.FlipType.None); companionController.aiAnimator.GetDirectionalAnimation("idle").Prefix = "idle"; prefab.GetComponent <tk2dSpriteAnimator>().GetClipByName("attack").wrapMode = tk2dSpriteAnimationClip.WrapMode.Once; BehaviorSpeculator component = Gusty.prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 2f; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" } }); } }
public static void BuildDenkSnavelPrefab() { if (prefab == null || !CompanionBuilder.companionDictionary.ContainsKey(guid)) { prefab = CompanionBuilder.BuildPrefab("Gumgun Denksnavel", guid, "NevernamedsItems/Resources/Companions/Denksnavel/denksnavel_idle_left_001", new IntVector2(5, 0), new IntVector2(5, 13)); var companionController = prefab.AddComponent <DenksnavelController>(); companionController.aiActor.MovementSpeed = 6.5f; companionController.CanCrossPits = true; companionController.aiActor.ActorShadowOffset = new Vector3(0, -0.5f); prefab.AddAnimation("idle_right", "NevernamedsItems/Resources/Companions/Denksnavel/denksnavel_idle_right", 12, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal, DirectionalAnimation.FlipType.None); prefab.AddAnimation("idle_left", "NevernamedsItems/Resources/Companions/Denksnavel/denksnavel_idle_left", 12, CompanionBuilder.AnimationType.Idle, DirectionalAnimation.DirectionType.TwoWayHorizontal, DirectionalAnimation.FlipType.None); companionController.aiAnimator.GetDirectionalAnimation("idle").Prefix = "idle"; BehaviorSpeculator component = prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionMeleeAttack denksnavelattack = new CustomCompanionBehaviours.SimpleCompanionMeleeAttack(); denksnavelattack.DamagePerTick = 5; denksnavelattack.DesiredDistance = 2; denksnavelattack.TickDelay = 1; CustomCompanionBehaviours.SimpleCompanionApproach denksnavelapproach = new CustomCompanionBehaviours.SimpleCompanionApproach(); denksnavelapproach.DesiredDistance = 1; component.MovementBehaviors.Add(denksnavelapproach); component.AttackBehaviors.Add(denksnavelattack); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" } }); } }
public static void BuildPrefab() { if (!(DarkPrince.prefab != null || CompanionBuilder.companionDictionary.ContainsKey(DarkPrince.guid))) { DarkPrince.prefab = CompanionBuilder.BuildPrefab("Dark Prince", DarkPrince.guid, "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_idlefrontright_001", new IntVector2(6, 1), new IntVector2(5, 5)); var companionController = DarkPrince.prefab.AddComponent <DarkPrinceController>(); companionController.aiActor.MovementSpeed = 4f; AIAnimator animator = DarkPrince.prefab.GetOrAddComponent <AIAnimator>(); animator.AdvAddAnimation("idle", DirectionalAnimation.DirectionType.FourWay, CompanionBuilder.AnimationType.Idle, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_back_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_idlebackright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_front_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_idlefrontright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_front_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_idlefrontleft", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_back_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_idlebackleft", }, } ); animator.AdvAddAnimation("move", DirectionalAnimation.DirectionType.FourWay, CompanionBuilder.AnimationType.Move, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_back_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_walkbackright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_front_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_walkfrontright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_front_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_walkfrontleft", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_back_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_walkbackleft", }, } ); animator.AdvAddAnimation("attack", DirectionalAnimation.DirectionType.FourWay, CompanionBuilder.AnimationType.Other, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_back_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_attackbackright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_front_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_attackfrontright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_front_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_attackfrontleft", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_back_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/DarkPrince/darkprince_attackbackleft", }, } ); BehaviorSpeculator component = DarkPrince.prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 7f; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" }, CatchUpRadius = 6, CatchUpMaxSpeed = 10, CatchUpAccelTime = 1, CatchUpSpeed = 7, }); } }
public static void BuildPrefab() { bool flag = MolotovBuddy.prefab != null || CompanionBuilder.companionDictionary.ContainsKey(MolotovBuddy.guid); if (!flag) { MolotovBuddy.prefab = CompanionBuilder.BuildPrefab("Molotov Bud Companion", MolotovBuddy.guid, "NevernamedsItems/Resources/Companions/MolotovBud/molotovbud_idle_left_001", new IntVector2(12, 1), new IntVector2(5, 5)); var companionController = MolotovBuddy.prefab.AddComponent <MolotovCompanionBehaviour>(); companionController.CanInterceptBullets = false; companionController.companionID = CompanionController.CompanionIdentifier.NONE; companionController.aiActor.MovementSpeed = 6f; companionController.aiActor.healthHaver.PreventAllDamage = true; companionController.aiActor.CollisionDamage = 0f; companionController.aiActor.specRigidbody.CollideWithOthers = false; companionController.aiActor.specRigidbody.CollideWithTileMap = false; BehaviorSpeculator component = MolotovBuddy.prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 3; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" } }); //SET UP ANIMATIONS AIAnimator aiAnimator = companionController.aiAnimator; aiAnimator.MoveAnimation = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.TwoWayHorizontal, Flipped = new DirectionalAnimation.FlipType[2], AnimNames = new string[] { "move_right", "move_left" } }; aiAnimator.IdleAnimation = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.TwoWayHorizontal, Flipped = new DirectionalAnimation.FlipType[2], AnimNames = new string[] { "idle_right", "idle_left" } }; aiAnimator.OtherAnimations = new List <AIAnimator.NamedDirectionalAnimation> { new AIAnimator.NamedDirectionalAnimation { name = "burst", anim = new DirectionalAnimation { Type = DirectionalAnimation.DirectionType.Single, Prefix = "burst", AnimNames = new string[1], Flipped = new DirectionalAnimation.FlipType[1] } }, }; //ADD SPRITES TO THE ANIMATIONS bool flag3 = MolotovBuddy.MolotovBudAnimationCollection == null; if (flag3) { MolotovBuddy.MolotovBudAnimationCollection = SpriteBuilder.ConstructCollection(MolotovBuddy.prefab, "MolotovBudCompanion_Collection"); UnityEngine.Object.DontDestroyOnLoad(MolotovBuddy.MolotovBudAnimationCollection); for (int i = 0; i < MolotovBuddy.spritePaths.Length; i++) { SpriteBuilder.AddSpriteToCollection(MolotovBuddy.spritePaths[i], MolotovBuddy.MolotovBudAnimationCollection); } //Idling Animation SpriteBuilder.AddAnimation(companionController.spriteAnimator, MolotovBuddy.MolotovBudAnimationCollection, new List <int> { 4, 5, 6, 7, }, "idle_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 8f; SpriteBuilder.AddAnimation(companionController.spriteAnimator, MolotovBuddy.MolotovBudAnimationCollection, new List <int> { 0, 1, 2, 3, }, "idle_left", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 8f; //Running Animation SpriteBuilder.AddAnimation(companionController.spriteAnimator, MolotovBuddy.MolotovBudAnimationCollection, new List <int> { 14, 15, 16, 17, 18, 19 }, "move_right", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 8f; SpriteBuilder.AddAnimation(companionController.spriteAnimator, MolotovBuddy.MolotovBudAnimationCollection, new List <int> { 8, 9, 10, 11, 12, 13 }, "move_left", tk2dSpriteAnimationClip.WrapMode.Loop).fps = 8f; SpriteBuilder.AddAnimation(companionController.spriteAnimator, MolotovBuddy.MolotovBudAnimationCollection, new List <int> { 20, 21, 22, 23, 24, 25 }, "burst", tk2dSpriteAnimationClip.WrapMode.Once).fps = 12f; } } }
public static void BuildPrefab() { if (!(FunGuy.prefab != null || CompanionBuilder.companionDictionary.ContainsKey(FunGuy.guid))) { FunGuy.prefab = CompanionBuilder.BuildPrefab("Fun Guy", FunGuy.guid, "NevernamedsItems/Resources/Companions/FunGuy/funguy_idleright_001", new IntVector2(8, 2), new IntVector2(9, 11)); var companionController = FunGuy.prefab.AddComponent <FunGuyController>(); companionController.aiActor.MovementSpeed = 5f; companionController.specRigidbody.CollideWithTileMap = false; AIAnimator animator = FunGuy.prefab.GetOrAddComponent <AIAnimator>(); animator.AdvAddAnimation("idle", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Idle, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguy_idleright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguy_idleleft", } } ); animator.AdvAddAnimation("move", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Move, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguy_walkright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguy_moveleft", } } ); animator.AdvAddAnimation("attack", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Other, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 12, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguy_attackright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 12, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguy_attackleft", } } ); BehaviorSpeculator component = FunGuy.prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 4f; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" }, CatchUpRadius = 6, CatchUpMaxSpeed = 10, CatchUpAccelTime = 1, CatchUpSpeed = 7, }); } if (!(FunGuy.synergyPrefab != null || CompanionBuilder.companionDictionary.ContainsKey(FunGuy.synergyguid))) { FunGuy.synergyPrefab = CompanionBuilder.BuildPrefab("Fun Guy Synergy", FunGuy.synergyguid, "NevernamedsItems/Resources/Companions/FunGuy/funguysyn_idleright_001", new IntVector2(8, 2), new IntVector2(9, 11)); var companionController = FunGuy.synergyPrefab.AddComponent <FunGuyController>(); companionController.aiActor.MovementSpeed = 5f; companionController.specRigidbody.CollideWithTileMap = false; AIAnimator animator = FunGuy.synergyPrefab.GetOrAddComponent <AIAnimator>(); animator.AdvAddAnimation("idle", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Idle, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguysyn_idleright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguysyn_idleleft", } } ); animator.AdvAddAnimation("move", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Move, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguysyn_moveright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "move_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguysyn_moveleft", } } ); animator.AdvAddAnimation("attack", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Other, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 12, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguysyn_attackright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 12, pathDirectory = "NevernamedsItems/Resources/Companions/FunGuy/funguysyn_attackleft", } } ); BehaviorSpeculator component = FunGuy.synergyPrefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 4f; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" }, CatchUpRadius = 6, CatchUpMaxSpeed = 10, CatchUpAccelTime = 1, CatchUpSpeed = 7, }); } }
public static void BuildPrefab() { if (!(AngrySpirit.prefab != null || CompanionBuilder.companionDictionary.ContainsKey(AngrySpirit.guid))) { AngrySpirit.prefab = CompanionBuilder.BuildPrefab("Angry Spirit", AngrySpirit.guid, "NevernamedsItems/Resources/Companions/AngrySpirit/angryspirit_idleright_001", new IntVector2(2, 2), new IntVector2(12, 14)); var companionController = AngrySpirit.prefab.AddComponent <AngrySpiritController>(); companionController.aiActor.MovementSpeed = 6f; companionController.CanCrossPits = true; companionController.aiActor.SetIsFlying(true, "Flying Entity", false, true); companionController.aiActor.ActorShadowOffset = new Vector3(0, -0.25f); AIAnimator animator = AngrySpirit.prefab.GetOrAddComponent <AIAnimator>(); animator.AdvAddAnimation("idle", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Idle, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/AngrySpirit/angryspirit_idleright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "idle_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Loop, fps = 9, pathDirectory = "NevernamedsItems/Resources/Companions/AngrySpirit/angryspirit_idleleft", } } ); animator.AdvAddAnimation("attack", DirectionalAnimation.DirectionType.TwoWayHorizontal, CompanionBuilder.AnimationType.Other, new List <AnimationUtilityExtensions.DirectionalAnimationData>() { new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_right", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 12, pathDirectory = "NevernamedsItems/Resources/Companions/AngrySpirit/angryspirit_attackright", }, new AnimationUtilityExtensions.DirectionalAnimationData() { subAnimationName = "attack_left", wrapMode = tk2dSpriteAnimationClip.WrapMode.Once, fps = 12, pathDirectory = "NevernamedsItems/Resources/Companions/AngrySpirit/angryspirit_attackleft", } } ); BehaviorSpeculator component = AngrySpirit.prefab.GetComponent <BehaviorSpeculator>(); CustomCompanionBehaviours.SimpleCompanionApproach approach = new CustomCompanionBehaviours.SimpleCompanionApproach(); approach.DesiredDistance = 5f; component.MovementBehaviors.Add(approach); component.MovementBehaviors.Add(new CompanionFollowPlayerBehavior { IdleAnimations = new string[] { "idle" }, CatchUpRadius = 6, CatchUpMaxSpeed = 10, CatchUpAccelTime = 1, CatchUpSpeed = 7, }); } }