public static void ChangeEnemiesState(ChampionState state) { foreach (GameObject obj in enemies) { obj.GetComponent <EnemyController>().enemyState = state; } } // changing the enemy state to smth
void Update() { switch (TacticsMove.gameState) { case GameState.FightingRound: if (championState == ChampionState.Moving) { MoveChampion(); } else if (championState == ChampionState.Attacking) { FightTarget(); } break; case GameState.BuyingRound: championState = ChampionState.Idle; if (selected) { MakeCurrentTilePointedAndPreviousUnpointed(); } break; } }
void OnCastSpell(SpellCastEventData e) { //TODO: this should be refactored. I am tired. switch (e.Type) { case SpellTypes.ManMega_RocketRampage: PlaySound(Sounds.ManMega_1, e.Position); break; case SpellTypes.ManMega_Slash: PlaySound(Sounds.ManMega_2, e.Position); break; case SpellTypes.ManMega_HintOfASpark: PlaySound(Sounds.ManMega_3, e.Position); break; case SpellTypes.ManMega_Shotgun: PlaySound(Sounds.ManMega_4, e.Position); break; case SpellTypes.Zoro_Tooth: PlaySound(Sounds.Zero_1, e.Position); break; case SpellTypes.Zoro_Slash: PlaySound(Sounds.Zero_2, e.Position); break; case SpellTypes.Zoro_Double: PlaySound(Sounds.Zero_3, e.Position); break; case SpellTypes.Zoro_Wall: PlaySound(Sounds.Zero_4, e.Position); break; } var s = GetSpellFromType(new ClientLinearSpell(e.ID, e.Type, e.Position, e.Time, e.Velocity, e.Range, e.Width)); Spells.Add(e.ID, s); GameWorld.AddChild(s); if (OurChampion != null && OurChampion.Champion.ID == e.OwnerID) { ChampionState.SetSpellCooldown(e.Type, e.Cooldown); } }
public static void ChangeChampionsState(ChampionState state) { foreach (GameObject obj in champions) { obj.GetComponent <AllyChampController>().championState = state; } } // changing the champion state to smth
void FightTarget() { //funckiq za biene na target.... if (!target.GetComponent <AllyChampController>().isDead&& Time.time > timeForNextAttack) { AttackTarget(); timeForNextAttack = Time.time + (1 / attackSpeed); } else if (target.GetComponent <AllyChampController>().isDead) { enemyState = ChampionState.Moving; } }
public void MoveChampionTowardsTarget() // moves the champion towards his target according to the shortest path { if (!IsTargetInRange() || moving) { MoveToNextTileFromShortestPath(); timeForNextAttack = Time.time + (1 / AttackSpeed); // in order not to attack instantly when target is reached //CalculateDistanceToTarget(); //gameObject.transform.position += GetDirectionToTarget() * Time.deltaTime * movementSpeed; } else if (IsTargetInRange()) { championState = ChampionState.Attacking; } }
public void FightTarget() // the champion battles his current target until it is dead { CalculateDistanceToTarget(); if (distanceToTarget > AttackRange) // ako po vreme na bitka, targeta se otdalechi ot range da trugva kam nego { championState = ChampionState.Moving; return; } if (!target.GetComponent <ChampionController>().isDead&& Time.time > timeForNextAttack) { AttackTarget(); timeForNextAttack = Time.time + (1 / AttackSpeed); } else if (target.GetComponent <ChampionController>().isDead) { championState = ChampionState.Moving; } }
void Update() { switch (TacticsMove.gameState) { case GameState.FightingRound: if (enemyState == ChampionState.Moving) { MoveEnemy(); } else if (enemyState == ChampionState.Attacking) { FightTarget(); } break; case GameState.BuyingRound: enemyState = ChampionState.Idle; break; } }
void UpdateHUD(GameTime dt) { if (OurChampion != null) { // Update the health ChampionState.MaxLife = OurChampion.Champion.MaxHealth; ChampionState.CurrentLife = OurChampion.Champion.Health; // Update the camera positionning var screen = (ScreenService)Services.GetService(typeof(ScreenService)); Camera.CenterCameraTowards(OurChampion.Champion.GetHandsPosition(), screen.GameWindowSize.X, screen.GameWindowSize.Y, Match.World.Map.GetWidthTiles() * Tile.WIDTH, Match.World.Map.GetHeightTiles() * Tile.HEIGHT); GameWorld.Position = GameLibHelper.ToVector2(-Camera.WorldPosition); // Update the cooldowns ChampionState.Update(dt.ElapsedGameTime); } UpdateParallax(); }
void MoveEnemyTowardsTarget() { if (target == null) { return; } Vector3 headingTowardTarget = target.transform.position - gameObject.transform.position; // posoka kam targeta distanceToTarget = headingTowardTarget.magnitude; // distanciq do targeta Vector3 directionToTarget = headingTowardTarget / distanceToTarget; // posoka do targeta if (!IsTargetReached()) { gameObject.transform.position += directionToTarget * Time.deltaTime * movementSpeed; timeForNextAttack = Time.time + (1 / attackSpeed); // in order not to attack instantly when target is reached } else if (IsTargetReached()) { enemyState = ChampionState.Attacking; } }
public void Spawn(Vector2 position) { State = ChampionState.Idle; }
public void Initialize(ChampionData data) { Data = data; Health = Data.MaxHealth; State = ChampionState.None; }