private void EnemyInstance() { if (currentEnemy == null) { currentEnemy = Instantiate(Enemy, Vector3.zero, Quaternion.identity); } }
public RankingSimulator( IRandom random, Player player, EnemyPlayerDigest enemyPlayerDigest, List <Guid> foods, RankingSimulatorSheets rankingSimulatorSheets, int stageId, ArenaInfo arenaInfo, ArenaInfo enemyInfo, CostumeStatSheet costumeStatSheet ) : base( random, player, foods, rankingSimulatorSheets ) { _enemyPlayer = new EnemyPlayer(enemyPlayerDigest, CharacterSheet, CharacterLevelSheet, EquipmentItemSetEffectSheet) { Simulator = this }; _enemyPlayer.Stats.EqualizeCurrentHPWithHP(); _stageId = stageId; _arenaInfo = arenaInfo; _enemyInfo = enemyInfo; WeeklyArenaRewardSheet = rankingSimulatorSheets.WeeklyArenaRewardSheet; if (!(costumeStatSheet is null)) { Player.SetCostumeStat(costumeStatSheet); _enemyPlayer.SetCostumeStat(costumeStatSheet); } }
void Awake() { animator = GetComponentInChildren <Animator> (); pathfinder = GetComponent <Pathfinder> (); enemyPlayer = GetComponent <EnemyPlayer> (); }
public virtual void InitializeTests() { HumanPlayer = new HumanPlayer(69); EnemyPlayer = new EnemyPlayer(); GameState = new GameState(new ActionQueue()); ChoicesToMake = new List <object>(); AttackCard = AttackAnEnemy(3); HealCard = SelfDamageAndHealAlly(1, 4); CopyCard = CopyACard(); Friend1 = new Unit(HumanPlayer, GenerateUnitStats(15, 4), this); Friend2 = new Unit(HumanPlayer, GenerateUnitStats(7, 2), this); Enemy1 = new Unit(EnemyPlayer, GenerateUnitStats(1, 0), this); Enemy2 = new Unit(EnemyPlayer, GenerateUnitStats(2, 0), this); Enemy3 = new Unit(EnemyPlayer, GenerateUnitStats(3, 0), this); GameState.AddUnits(new List <Unit> { Friend1, Friend2, Enemy1, Enemy2, Enemy3, }); }
protected override void Awake() { base.Awake(); mEnemyPlayer = mEnemy as EnemyPlayer; mRangedAttackRadiusSquared = mRangedRadius * mRangedRadius; mActionTimer = mActionRate; }
// Use this for initialization void Start() { currentState = BattleStates.PLAYERMOVE; playerhealth = BasePlayer.getHealth(); enemyhealth = EnemyPlayer.getHealth(); energy = BasePlayer.getEnergy(); }
private void Start() { enemyHealth = GetComponent <EnemyHealth>(); enemyPlayer = GetComponent <EnemyPlayer>(); playerHealth = FindObjectOfType <PlayerHealth>(); enemyPlayer.OnTargetSelected += EnemyPlayer_OnTargetSelected; anim.SetBool("isWalking", true); }
/// <summary> /// Returns the rank between 1 and playerCount /// </summary> /// <param name="player"></param> /// <returns></returns> public int GetRankOfPlayer(EnemyPlayer player) { if (player == null) { return(-1); } SortByScore(); return(PlayerList.IndexOf(player) + 1); }
protected override void OnTriggerEnter2D(Collider2D collision) { base.OnTriggerEnter2D(collision); if (collision.gameObject.CompareTag(Data.TAG_ENEMY)) { EnemyPlayer enemy = collision.gameObject.GetComponent <EnemyPlayer>(); enemy.HealtPoint--; Destroing(); } }
public static bool IsAttacking() { foreach (var card in EnemyPlayer.CardsInField()) { if (card.IsAttacking) { return(true); } } return(false); }
public void AddEnemyPlayers(params PlayerInfo[] enemies) { foreach (PlayerInfo enemy in enemies) { EnemyPlayer newEnemy = new EnemyPlayer(enemy.id, enemy.name, enemy.avatarType); newEnemy.CreateResources(); PlayerList.Add(newEnemy); UnityEngine.Debug.Log("Added player " + enemy.name + ", now at count: " + PlayerList.Count); } NotifyObservers(PlayerList.Count); }
void OnTriggerEnter2D(Collider2D obj) { EnemyPlayer enemy = obj.gameObject.GetComponent <EnemyPlayer> (); if (enemy) { Debug.Log("Hit enemy player"); enemy.health -= damage; Debug.Log(enemy.health); Destroy(gameObject); } }
public virtual void DidHitObject(Collider collider, Vector3 hitPoint, Vector3 hitVector) { EnemyPlayer enemyplayer = collider.GetComponent <Player>(); if (isAlive && !isKnockedOut && enemyplayer != null && enemyplayer.CanBeHit() && collider.tag != gameObject.tag) { if (collider.attachedRigidbody != null) { HitEnemyPlayer(enemyplayer, hitPoint, hitVector); } } }
public RankingSimulator( IRandom random, AvatarState avatarState, AvatarState enemyAvatarState, List <Guid> foods, TableSheets tableSheets, int stageId) : base(random, avatarState, foods, tableSheets) { _enemyPlayer = new EnemyPlayer(enemyAvatarState, this); _enemyPlayer.Stats.EqualizeCurrentHPWithHP(); _stageId = stageId; }
public void AdaptTo(EnemyPlayer player) { if (pName != null) { pName.text = player.Name; } if (city != null) { city.text = cityPrefix + player.CurCityName; } if (cultureText != null) { cultureText.text = culturePrefix + player.CulturePoints.ToString(); } if (icon != null && player.Avatar.Icon != null) { icon.sprite = player.Avatar.Icon; } Type monType = typeof(MoneyResource); if (player.Resources.ContainsKey(monType)) { float curMoney = player.Resources[monType].Value; float maxMoney = player.Avatar.StartValues.ContainsKey(monType) ? player.Avatar.StartValues[monType] : 1400f; GameManager.Instance.ExecuteOnMain(() => moneyBar.fillAmount = curMoney / maxMoney); string prefix = monType.Name.Substring(0, monType.Name.IndexOf('R')); string unit = player.Resources[monType].GetUnitString(); string moneyTextString = string.Format("{0}: {1} {2}", prefix, curMoney, unit); if (moneyText != null) { GameManager.Instance.ExecuteOnMain(() => moneyText.text = moneyTextString); } } Type co2Type = typeof(CO2Resource); if (player.Resources.ContainsKey(co2Type)) { string prefix = co2Type.Name.Substring(0, co2Type.Name.IndexOf('R')); string unit = player.Resources[co2Type].GetUnitString(); string co2TextString = string.Format("{0}: {1} {2}", prefix, player.Resources[co2Type].Value, unit); if (co2Type != null) { GameManager.Instance.ExecuteOnMain(() => co2Text.text = co2TextString); } } }
public void UpdatePlayer(ScoreUpdateMessageable msg) { EnemyPlayer p = PlayerList.Find(e => e.playerId.Equals(msg.playerId)); if (p != null) { p.UpdateScore(msg.score); p.UpdateCulturePoints(msg.culturePoints); p.UpdateMoneyAndCo2(msg.resourceNames, msg.rawValues); UnityEngine.Debug.Log("updated score of " + p.Name + " to " + msg.score); NotifyObservers(PlayerList.Count); } }
public void MakeMove(Move move) { ShootState shootState; if (CurrentPlayer.IsEnemy) { shootState = Player.Shoot(move); } else { shootState = EnemyPlayer.Shoot(move); } AssignPlayer(shootState); }
protected override void CreateObjectSpawn() { int countEnemy = UnityEngine.Random.Range(_minCountCreateInTime, _maxCountCreateInTime); for (int i = 0; i < countEnemy; i++) { //враги появляются только с краёв карты int direction = UnityEngine.Random.Range(0, 4) > 2 ? 3 : 0; GameObject enemyInst = PoolManager.GetObject(PoolManager.NamePrefab.EnemyPlayer, GetStartPositionSpanObject(direction), Quaternion.identity); EnemyPlayer enemyParametrs = enemyInst.GetComponent <EnemyPlayer>(); enemyParametrs.SetSpeed(GetStartSpeedSpawnOnject(direction)); enemyParametrs.StartShoot(); } }
public GameState CheckedGameState() { if (EnemyPlayer.CheckedBoardState() == BoardState.GameOver) { return(GameState.Win); } else if (Player.CheckedBoardState() == BoardState.GameOver) { return(GameState.GameOver); } else { return(GameState.Game); } }
public static void InstantiatePlayers() { foreach (var p in Players) { switch (p.Value.ID) { case ObjectIdentity.Main: MainPlayer.Instantiate(p.Key, p.Value.PlayerData, Vector2.zero); break; case ObjectIdentity.Enemy: EnemyPlayer.Instantiate(p.Key, p.Value.PlayerData, Vector2.zero); break; } } }
public void initGame() { if (_client.PlayerNumber == 1 && !_headAdded) { MainPlayer.RemoveAt(0); MainPlayer.Add(new Head(_snake_Head_Pl1_Texture, new Vector2(0, 0), 0)); EnemyPlayer.Add(new Head(_snake_Head_Pl2_Texture, new Vector2(0, 0), 0)); _headAdded = true; } else if (_client.PlayerNumber == 2 && !_headAdded) { MainPlayer.RemoveAt(0); MainPlayer.Add(new Head(_snake_Head_Pl2_Texture, new Vector2(0, 0), 0)); EnemyPlayer.Add(new Head(_snake_Head_Pl1_Texture, new Vector2(0, 0), 0)); _headAdded = true; } }
void Awake() { Singleton.inGameManager = this; _uiPlayer = transform.Find("InGameUI/UI_Player").GetComponent <UI_Player>(); _uiEnemy = transform.Find("InGameUI/UI_Enemy").GetComponent <UI_Enemy>(); _uiRound = transform.Find("InGameUI/UI_Round").GetComponent <UI_Round>(); _myPlayer = transform.Find("Player/AnchorL/Player_01").GetComponent <MyPlayer>(); _enemyPlayer = transform.Find("Player/AnchorR/Player_02").GetComponent <EnemyPlayer>(); _effectAttack = transform.Find("InGameUI/Ef").GetComponent <Effect_Attack>(); _quarter = 1; _attribute = CARD_TYPE.END; _bDuece = false; _gameState = GAME_STATE.END; }
public void Constructor() { var digest = new EnemyPlayerDigest(_avatarState); Assert.Equal(_avatarState.NameWithHash, digest.NameWithHash); Assert.Equal(_avatarState.characterId, digest.CharacterId); Assert.Equal(_avatarState.level, digest.Level); Assert.Equal(2, digest.HairIndex); Assert.Equal(3, digest.LensIndex); Assert.Equal(4, digest.EarIndex); Assert.Equal(5, digest.TailIndex); Assert.Single(digest.Equipments); Assert.Single(digest.Costumes); var enemyPlayer = new EnemyPlayer( digest, _tableSheets.CharacterSheet, _tableSheets.CharacterLevelSheet, _tableSheets.EquipmentItemSetEffectSheet); Assert.Single(enemyPlayer.Equipments); Assert.Single(enemyPlayer.Costumes); }
private void UpdateRankings() { GameManager.Instance.PlayerListManager.SortByScore(); int playerCnt = GameManager.Instance.PlayerListManager.PlayerList.Count; for (int i = 1; i < 8; i++) { if (i <= playerCnt) { EnemyPlayer p = GameManager.Instance.PlayerListManager.PlayerList[i - 1]; Text[] texts = playerSets[i].gameObject.GetComponentsInChildren <Text>(); Image[] images = playerSets[i].gameObject.GetComponentsInChildren <Image>(true); images[1].sprite = p.Avatar.Icon; texts[1].text = p.Name; texts[2].text = p.CurrentScore.ToString(); playerSets[i].SetActive(true); } else { playerSets[i].SetActive(false); } } }
public RankingSimulator( IRandom random, AvatarState avatarState, AvatarState enemyAvatarState, List <Guid> foods, RankingSimulatorSheets rankingSimulatorSheets, int stageId, ArenaInfo arenaInfo, ArenaInfo enemyInfo ) : base( random, avatarState, foods, rankingSimulatorSheets ) { _enemyPlayer = new EnemyPlayer(enemyAvatarState, this); _enemyPlayer.Stats.EqualizeCurrentHPWithHP(); _stageId = stageId; _arenaInfo = arenaInfo; _enemyInfo = enemyInfo; _avatarState = avatarState; WeeklyArenaRewardSheet = rankingSimulatorSheets.WeeklyArenaRewardSheet; }
void Start() { enemyPlayer = GetComponent <EnemyPlayer> (); enemyPlayer.OnTargetSelected += EnemyPlayer_OnTargetSelected; }
void Awake() { pathFinder = GetComponent <PathFinder> (); enemyPlayer = GetComponent <EnemyPlayer> (); }
void OnGUI() { //need to work on not fixed postion for the Rectangle GUI.Label(new Rect(20, 20, 100, 20), "Health: " + playerhealth); GUI.Label(new Rect(20, 40, 200, 20), "Enemy Health: " + enemyhealth); GUI.Label(new Rect(20, 60, 200, 20), "Energy: " + energy); GUI.Label(new Rect(20, 80, 100, 20), winning); GUI.Label(new Rect(20, 100, 100, 20), energyStatus); GUI.Label(new Rect(275, 360, 100, 20), "Attacks"); //if (energy > 0) { if (energy >= attack1.EnergyCost) { if (GUI.Button(new Rect(175, 400, 100, 20), attack1.Name)) { if (currentState == BattleStates.PLAYERMOVE) { enemyhealth -= attack1.Damage; energy -= attack1.EnergyCost; if (enemyhealth > 0) { currentState = BattleStates.ENEMYMOVE; } else { enemyhealth = 0; winning = "You Win!"; currentState = BattleStates.WIN; } } } } else if (GUI.Button(new Rect(325, 430, 100, 20), attack4.Name)) { if (currentState == BattleStates.PLAYERMOVE) { enemyhealth -= attack4.Damage; energy += attack4.EnergyCost; //gives player +2 energy currentState = BattleStates.ENEMYMOVE; if (enemyhealth > 0) { currentState = BattleStates.ENEMYMOVE; } else { enemyhealth = 0; winning = "You Win!"; currentState = BattleStates.WIN; } } } if /*(BasePlayer.canAttack (attack2)==true)*/ (energy >= attack2.EnergyCost) { if (GUI.Button(new Rect(325, 400, 100, 20), attack2.Name)) { if (currentState == BattleStates.PLAYERMOVE) { enemyhealth -= attack2.Damage; energy -= attack2.EnergyCost; currentState = BattleStates.ENEMYMOVE; if (enemyhealth > 0) { currentState = BattleStates.ENEMYMOVE; } else { enemyhealth = 0; winning = "You Win!"; currentState = BattleStates.WIN; } } } } else if (GUI.Button(new Rect(325, 430, 100, 20), attack4.Name)) { if (currentState == BattleStates.PLAYERMOVE) { enemyhealth -= attack4.Damage; energy += attack4.EnergyCost; //gives player +2 energy currentState = BattleStates.ENEMYMOVE; if (enemyhealth > 0) { currentState = BattleStates.ENEMYMOVE; } else { enemyhealth = 0; winning = "You Win!"; currentState = BattleStates.WIN; } } } if /*(BasePlayer.canAttack (attack3)==true)*/ (energy >= attack3.EnergyCost) { if (GUI.Button(new Rect(175, 430, 100, 20), attack3.Name)) { if (currentState == BattleStates.PLAYERMOVE) { enemyhealth -= attack3.Damage; energy -= attack3.EnergyCost; currentState = BattleStates.ENEMYMOVE; if (enemyhealth > 0) { currentState = BattleStates.ENEMYMOVE; } else { enemyhealth = 0; winning = "You Win!"; currentState = BattleStates.WIN; } } } } else if (GUI.Button(new Rect(325, 430, 100, 20), attack4.Name)) { if (currentState == BattleStates.PLAYERMOVE) { enemyhealth -= attack4.Damage; energy += attack4.EnergyCost; //gives player +2 energy currentState = BattleStates.ENEMYMOVE; if (enemyhealth > 0) { currentState = BattleStates.ENEMYMOVE; } else { enemyhealth = 0; winning = "You Win!"; currentState = BattleStates.WIN; } } } if (GUI.Button(new Rect(325, 430, 100, 20), attack4.Name)) { if (currentState == BattleStates.PLAYERMOVE) { enemyhealth -= attack4.Damage; energy += attack4.EnergyCost; //gives player +2 energy currentState = BattleStates.ENEMYMOVE; if (enemyhealth > 0) { currentState = BattleStates.ENEMYMOVE; } else { enemyhealth = 0; winning = "You Win!"; currentState = BattleStates.WIN; } } } if (currentState == BattleStates.ENEMYMOVE) { playerhealth -= EnemyPlayer.getEnemyAttack().Damage; if (playerhealth > 0) { currentState = BattleStates.PLAYERMOVE; } else { playerhealth = 0; winning = "You Lose!"; currentState = BattleStates.LOSE; } } }
void Start() { enemyPlayer = GetComponent <EnemyPlayer> (); enemyPlayer.OnTargetSelected += EnemyPlayer_OnTargetSelected; enemyAnimation = enemyPlayer.GetComponent <EnemyAnimation>(); }
public void AddLocalPlayer(EnemyPlayer enemy) { PlayerList.Add(enemy); UnityEngine.Debug.Log("Added player " + enemy.Name + ", now at count: " + PlayerList.Count); NotifyObservers(PlayerList.Count); }