public void Setup(bool isPlayerTeam, GameObject Own) { this.isPlayerTeam = isPlayerTeam; m_GameObject = Instantiate(Own, transform.position, Quaternion.identity, transform); ObjectiveCursor = m_GameObject.transform.Find("Objective").gameObject; ObjectiveCursor.SetActive(false); CharStats = m_GameObject.GetComponent <Stats>(); Level = CharStats.Level; Health = CharStats.Health; Speed = CharStats.Speed; charclass = CharStats.charclass; particles = CharStats.particles; LM = m_GameObject.GetComponent <LayerManager>(); CharStats.parent = this.gameObject; if (isPlayerTeam) { InShield = m_GameObject.transform.Find("SheerWillShield").gameObject; } else { Vector3 transform = m_GameObject.transform.localScale; transform.x *= -1; m_GameObject.transform.localScale = transform; } Vector3 namePos = transform.position; invulnerable = false; healthSystem = new HealthSystem(CharStats.Health); if (CharStats.name != "Amadea") { healthBar = new World_Bar(transform, new Vector3(0, 24), new Vector3(12, 1.7f), Color.grey, Color.red, 1f, 100, new World_Bar.Outline { color = Color.black, size = .6f }); namePos.x -= 8; namePos.y += 25; } else { healthBar = new World_Bar(transform, new Vector3(0, 29), new Vector3(12, 1.7f), Color.grey, Color.red, 1f, 100, new World_Bar.Outline { color = Color.black, size = .6f }); namePos.x -= 8; namePos.y += 30; } healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; animator = m_GameObject.GetComponentInChildren <Animator>(); going = false; TextScript.Create(namePos, CharStats.name, 35, false, gameObject); //PlayAnimIdle(); }
private void Awake() { enemyList.Add(this); EnemyMain = GetComponent <EnemyMain>(); state = State.Normal; healthBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(10, 1.3f), Color.grey, Color.red, 1f, 10000, new World_Bar.Outline { color = Color.black, size = .5f }); }
private void Awake() { spriteRenderer = GetComponent <SpriteRenderer>(); healthSystem = new HealthSystem(40); healthBar = new World_Bar(transform, new Vector3(0, 1), new Vector3(12, 1.5f), Color.grey, Color.red, 1f, 10000, new World_Bar.Outline { color = Color.black, size = .5f }); healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; healthSystem.OnDead += HealthSystem_OnDead; }
private void Awake() { characterBase = GetComponent <Character_Base>(); selectedGameObject = transform.Find("Selected").gameObject; movePosition = GetComponent <MovePositionPathfinding>(); //SetSelectedVisible(false); state = State.Normal; healthSystem = new HealthSystem(100); healthBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(10, 1.3f), Color.grey, Color.red, 1f, 10000, new World_Bar.Outline { color = Color.black, size = .5f }); healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; }
private Tower(Transform towerTransform, Action onTowerConstructedAction) { this.towerTransform = towerTransform; this.onTowerConstructedAction = onTowerConstructedAction; spriteRenderer = towerTransform.GetComponent <SpriteRenderer>(); spriteRenderer.sprite = GameAssets.i.towerConstruction_1; constructionTick = 0; constructionTickMax = 10; FunctionPeriodic.Create(IncreaseConstructionTick, .5f); constructionBar = new World_Bar(towerTransform, new Vector3(0, -5), new Vector3(10, 1.5f), null, Color.yellow, 0f, 0, new World_Bar.Outline { color = Color.black, size = 1f }); }
private void Awake() { Instance = this; playerMain = GetComponent <PlayerMain>(); materialTintColor = GetComponent <MaterialTintColor>(); aimLightTransform = transform.Find("AimLight"); state = State.Normal; healthSystem = new HealthSystem(100); healthBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(12, 1.5f), Color.grey, Color.red, 1f, 10000, new World_Bar.Outline { color = Color.black, size = .5f }); healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; weaponPistol = new Weapon(Weapon.WeaponType.Pistol); weaponShotgun = new Weapon(Weapon.WeaponType.Shotgun); weaponRifle = new Weapon(Weapon.WeaponType.Rifle); weaponPunch = new Weapon(Weapon.WeaponType.Punch); }
public void Setup(Character character) { this.character = character; transform.position = character.position; healthSystem = new HealthSystem(character.stats.healthMax); healthSystem.SetHealthAmount(character.stats.health); healthWorldBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(15, 2), Color.grey, Color.red, healthSystem.GetHealthPercent(), UnityEngine.Random.Range(10000, 11000), new World_Bar.Outline { color = Color.black, size = .6f }); healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; RefreshHealthBar(); RefreshTexture(); playerBase.GetAnimatedWalker().SetAnimations(UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Idle"), UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Walk"), 1f, .7f); OvermapHandler.GetInstance().OnOvermapStopped += NPCOvermap_OnOvermapStopped; }
public void Setup(Character character, PlayerOvermap playerOvermap, Vector3 followOffset) { this.character = character; this.playerOvermap = playerOvermap; this.followOffset = followOffset; switch (character.type) { case Character.Type.Tank: material.mainTexture = GameAssets.i.t_Tank; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dSwordShield_Idle, GameAssets.UnitAnimTypeEnum.dSwordShield_Walk, 1f, 1f); transform.localScale = Vector3.one * 1.2f; break; case Character.Type.Sleezer: material.mainTexture = GameAssets.i.t_Sleezer; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dBareHands_Idle, GameAssets.UnitAnimTypeEnum.dBareHands_Walk, 1f, 1f); transform.localScale = Vector3.one * 0.7f; sleezerTripUpTimer = 5f; if (GameData.state == GameData.State.DefeatedTank) { sleezerTripUpTimer = 2f; } speed = 65f; break; case Character.Type.Healer: material.mainTexture = GameAssets.i.t_Healer; playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dDualDagger_Idle, GameAssets.UnitAnimTypeEnum.dDualDagger_Walk, 1f, 1f); transform.localScale = Vector3.one * 1.0f; break; } healthSystem = new HealthSystem(character.stats.healthMax); healthSystem.SetHealthAmount(character.stats.health); healthWorldBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(15, 2), Color.grey, Color.red, healthSystem.GetHealthPercent(), UnityEngine.Random.Range(10000, 11000), new World_Bar.Outline { color = Color.black, size = .6f }); healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; RefreshHealthBar(); SetTargetMovePosition(playerOvermap.GetPosition() + followOffset); }
public void Setup(bool isPlayerTeam) { this.isPlayerTeam = isPlayerTeam; if (isPlayerTeam) { characterBase.SetAnimsSwordTwoHandedBack(); characterBase.GetMaterial().mainTexture = BattleHandler.GetInstance().playerSpritesheet; } else { characterBase.SetAnimsSwordShield(); characterBase.GetMaterial().mainTexture = BattleHandler.GetInstance().enemySpritesheet; } healthSystem = new HealthSystem(100); healthBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(12, 1.7f), Color.grey, Color.red, 1f, 100, new World_Bar.Outline { color = Color.black, size = .6f }); healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged; PlayAnimIdle(); }
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(); }