コード例 #1
0
ファイル: GameManager.cs プロジェクト: hamura-pi/testWork
 private void EnemyInstance()
 {
     if (currentEnemy == null)
     {
         currentEnemy = Instantiate(Enemy, Vector3.zero, Quaternion.identity);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
    void Awake()
    {
        animator = GetComponentInChildren <Animator> ();

        pathfinder  = GetComponent <Pathfinder> ();
        enemyPlayer = GetComponent <EnemyPlayer> ();
    }
コード例 #4
0
        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,
            });
        }
コード例 #5
0
    protected override void Awake()
    {
        base.Awake();

        mEnemyPlayer = mEnemy as EnemyPlayer;
        mRangedAttackRadiusSquared = mRangedRadius * mRangedRadius;
        mActionTimer = mActionRate;
    }
コード例 #6
0
    protected override void Awake()
    {
        base.Awake();

        mEnemyPlayer = mEnemy as EnemyPlayer;
        mRangedAttackRadiusSquared = mRangedRadius * mRangedRadius;
        mActionTimer = mActionRate;
    }
コード例 #7
0
    // Use this for initialization
    void Start()
    {
        currentState = BattleStates.PLAYERMOVE;

        playerhealth = BasePlayer.getHealth();
        enemyhealth  = EnemyPlayer.getHealth();
        energy       = BasePlayer.getEnergy();
    }
コード例 #8
0
 private void Start()
 {
     enemyHealth  = GetComponent <EnemyHealth>();
     enemyPlayer  = GetComponent <EnemyPlayer>();
     playerHealth = FindObjectOfType <PlayerHealth>();
     enemyPlayer.OnTargetSelected += EnemyPlayer_OnTargetSelected;
     anim.SetBool("isWalking", true);
 }
コード例 #9
0
    /// <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);
    }
コード例 #10
0
    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();
        }
    }
コード例 #11
0
 public static bool IsAttacking()
 {
     foreach (var card in EnemyPlayer.CardsInField())
     {
         if (card.IsAttacking)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #12
0
 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);
 }
コード例 #13
0
    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);
        }
    }
コード例 #14
0
    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);
            }
        }
    }
コード例 #15
0
ファイル: RankingSimulator.cs プロジェクト: x86chi/lib9c
 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;
 }
コード例 #16
0
    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);
            }
        }
    }
コード例 #17
0
    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);
        }
    }
コード例 #18
0
        public void MakeMove(Move move)
        {
            ShootState shootState;

            if (CurrentPlayer.IsEnemy)
            {
                shootState = Player.Shoot(move);
            }
            else
            {
                shootState = EnemyPlayer.Shoot(move);
            }

            AssignPlayer(shootState);
        }
コード例 #19
0
    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();
        }
    }
コード例 #20
0
 public GameState CheckedGameState()
 {
     if (EnemyPlayer.CheckedBoardState() == BoardState.GameOver)
     {
         return(GameState.Win);
     }
     else if (Player.CheckedBoardState() == BoardState.GameOver)
     {
         return(GameState.GameOver);
     }
     else
     {
         return(GameState.Game);
     }
 }
コード例 #21
0
ファイル: CacheManager.cs プロジェクト: Saoish/GreedyGreedy
    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;
            }
        }
    }
コード例 #22
0
ファイル: GameManager.cs プロジェクト: HaDeLuxe/Game_2_Client
        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;
            }
        }
コード例 #23
0
ファイル: InGameManager.cs プロジェクト: jsh6858/FreeDust
    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;
    }
コード例 #24
0
        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);
        }
コード例 #25
0
    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);
            }
        }
    }
コード例 #26
0
 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;
 }
コード例 #27
0
 void Start()
 {
     enemyPlayer = GetComponent <EnemyPlayer> ();
     enemyPlayer.OnTargetSelected += EnemyPlayer_OnTargetSelected;
 }
コード例 #28
0
 void Awake()
 {
     pathFinder  = GetComponent <PathFinder> ();
     enemyPlayer = GetComponent <EnemyPlayer> ();
 }
コード例 #29
0
    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;
            }
        }
    }
コード例 #30
0
 void Start()
 {
     enemyPlayer = GetComponent <EnemyPlayer> ();
     enemyPlayer.OnTargetSelected += EnemyPlayer_OnTargetSelected;
     enemyAnimation = enemyPlayer.GetComponent <EnemyAnimation>();
 }
コード例 #31
0
 public void AddLocalPlayer(EnemyPlayer enemy)
 {
     PlayerList.Add(enemy);
     UnityEngine.Debug.Log("Added player " + enemy.Name + ", now at count: " + PlayerList.Count);
     NotifyObservers(PlayerList.Count);
 }