public static void SpawnCharacter(Character.Type characterType, BattleHandler.LanePosition lanePosition, bool isPlayerTeam, Character.Stats stats) { Transform characterTransform = Object.Instantiate(GameAssets.i.pfCharacterBattle, GetPosition(lanePosition, isPlayerTeam), Quaternion.identity); CharacterBattle characterBattle = characterTransform.GetComponent <CharacterBattle>(); characterBattle.Setup(characterType, lanePosition, GetPosition(lanePosition, isPlayerTeam), isPlayerTeam, stats); instance.characterBattleList.Add(characterBattle); }
public EnemyBattle(Character.Type characterType, BattleHandler.LanePosition lanePosition) { this.characterType = characterType; this.lanePosition = lanePosition; }
public void Setup(Character.Type characterType, BattleHandler.LanePosition lanePosition, Vector3 startingPosition, bool isPlayerTeam, Character.Stats stats) { this.characterType = characterType; this.lanePosition = lanePosition; this.startingPosition = startingPosition; this.isPlayerTeam = isPlayerTeam; this.stats = stats; hitUnitAnimType = GameAssets.UnitAnimTypeEnum.dBareHands_Hit; slideLeftUnitAnim = UnitAnim.GetUnitAnim("dBareHands_SlideLeft"); slideRightUnitAnim = UnitAnim.GetUnitAnim("dBareHands_SlideRight"); Vector3 healthWorldBarLocalPosition = new Vector3(0, 10); switch (characterType) { case Character.Type.Player: material.mainTexture = GameAssets.i.t_Player; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Idle, GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Sword; if (GameData.GetCharacter(Character.Type.Player).hasFtnDewArmor) { Texture2D newSpritesheetTexture = new Texture2D(material.mainTexture.width, material.mainTexture.height, TextureFormat.ARGB32, true); newSpritesheetTexture.SetPixels((material.mainTexture as Texture2D).GetPixels()); Color[] ftnDewArmorPixels = GameAssets.i.t_FtnDewArmor.GetPixels(0, 0, 512, 128); newSpritesheetTexture.SetPixels(0, 256, 512, 128, ftnDewArmorPixels); newSpritesheetTexture.Apply(); material.mainTexture = newSpritesheetTexture; } if (GameData.GetCharacter(Character.Type.Player).hasSwordThousandTruths) { Texture2D newSpritesheetTexture = new Texture2D(material.mainTexture.width, material.mainTexture.height, TextureFormat.ARGB32, true); newSpritesheetTexture.SetPixels((material.mainTexture as Texture2D).GetPixels()); Color[] swordThousandTruthsPixels = GameAssets.i.t_SwordThousandTruths.GetPixels(0, 0, 128, 128); newSpritesheetTexture.SetPixels(0, 128, 128, 128, swordThousandTruthsPixels); newSpritesheetTexture.Apply(); material.mainTexture = newSpritesheetTexture; } break; case Character.Type.Tank: material.mainTexture = GameAssets.i.t_Tank; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dSwordShield_Idle, GameAssets.UnitAnimTypeEnum.dSwordShield_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dSwordShield_Attack; transform.localScale = Vector3.one * 1.2f; break; case Character.Type.Healer: material.mainTexture = GameAssets.i.t_Healer; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dDualDagger_Idle, GameAssets.UnitAnimTypeEnum.dDualDagger_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dDualDagger_Attack; transform.localScale = Vector3.one * 1.0f; break; case Character.Type.EvilMonster: case Character.Type.EvilMonster_2: case Character.Type.EvilMonster_3: material.mainTexture = GameAssets.i.t_EvilMonster; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dBareHands_Idle, GameAssets.UnitAnimTypeEnum.dBareHands_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dBareHands_Punch; transform.localScale = Vector3.one * 1.8f; healthWorldBarLocalPosition.y = 9.5f; break; case Character.Type.Enemy_MinionOrange: material.mainTexture = GameAssets.i.t_EnemyMinionOrange; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dMinion_Idle, GameAssets.UnitAnimTypeEnum.dMinion_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dMinion_Attack; break; case Character.Type.Enemy_MinionRed: material.mainTexture = GameAssets.i.t_EnemyMinionRed; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dMinion_Idle, GameAssets.UnitAnimTypeEnum.dMinion_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dMinion_Attack; break; case Character.Type.Enemy_Ogre: material.mainTexture = GameAssets.i.t_Ogre; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dOgre_Idle, GameAssets.UnitAnimTypeEnum.dOgre_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dOgre_Attack; hitUnitAnimType = UnitAnimType.GetUnitAnimType("dOgre_Hit"); slideLeftUnitAnim = UnitAnim.GetUnitAnim("dOgre_SlideLeft"); slideRightUnitAnim = UnitAnim.GetUnitAnim("dOgre_SlideRight"); healthWorldBarLocalPosition.y = 12; break; case Character.Type.Enemy_Zombie: material.mainTexture = GameAssets.i.t_Zombie; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dZombie_Idle, GameAssets.UnitAnimTypeEnum.dZombie_Walk, 1f, 1f); attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dZombie_Attack; break; } transform.Find("Body").GetComponent <MeshRenderer>().material = material; healthSystem = new HealthSystem(stats.healthMax); healthSystem.SetHealthAmount(stats.health); healthWorldBar = new World_Bar(transform, healthWorldBarLocalPosition, new Vector3(12 * (stats.healthMax / 100f), 1.6f), Color.grey, Color.red, healthSystem.GetHealthPercent(), UnityEngine.Random.Range(1000, 2000), new World_Bar.Outline { color = Color.black, size = .6f }); healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; healthSystem.OnDead += HealthSystem_OnDead; PlayIdleAnim(); }