Exemple #1
0
 // Use this for initialization
 void Start()
 {
     currState   = BOT_FStateMachineRespawn.Stop;
     bOT_Profile = GetComponent <BOT_Profile>();
     gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
     mesh        = transform.Find("Player_3PNew:Character_Unwrapped:Egor");
     bOT_Manager = GetComponent <BOT_Manager>();
 }
 // Use this for initialization
 void Start()
 {
     navMeshAgent = GetComponent <NavMeshAgent> ();
     shootScript  = GetComponent <Shoot> ();
     bOT_Profile  = GetComponent <BOT_Profile>();
     bOT_Manager  = GetComponent <BOT_Manager>();
     photonView   = GetComponent <PhotonView>();
     Debug.Log(photonView.owner.GetTeam());
 }
    //Get a list of our enemy players
    public void GetOurEnemyPlayers()
    {
        if (emptyNumOfEn == numOfEnemy)
        {
            //Debug.Log("test");
            currState = AttackState.CheckIfEnemyIsReachable;
        }
        else
        {
            emptyNumOfEn++;

            for (int i = 0; i < numOfEnemy; i++)
            {
                GameObject playerObj = players[i];

                PlayerProfile playerProfile = playerObj.GetComponent <PlayerProfile>();
                BOT_Profile   botProfile    = playerObj.GetComponent <BOT_Profile>();

                if (!enemyTeam.Contains(playerObj))
                {
                    if (bOT_Profile.red == true)
                    {
                        if (playerProfile != null && playerProfile.blue == true)
                        {
                            enemyTeam.Add(playerObj);
                            return;
                        }

                        if (botProfile != null && botProfile.blue == true)
                        {
                            enemyTeam.Add(playerObj);
                        }
                    }
                    else
                    {
                        if (playerProfile != null && playerProfile.red == true)
                        {
                            enemyTeam.Add(playerObj);
                            return;
                        }

                        if (botProfile != null && botProfile.red == true)
                        {
                            enemyTeam.Add(playerObj);
                        }
                    }
                }
            }
        }
    }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        bOT_Profile = GetComponentInParent <BOT_Profile>();

        if (bOT_Profile.red == true)
        {
            GetComponent <Renderer>().material = redChar;
        }

        if (bOT_Profile.blue == true)
        {
            GetComponent <Renderer>().material = blueChar;
        }
    }
Exemple #5
0
    private void Start()
    {
        //Get references.
        localSettings = GameObject.Find("LocalSettings").GetComponent <LocalSettings>();

        foreach (PhotonPlayer player in PhotonNetwork.playerList)
        {
            if (player.GetTeam() == PunTeams.Team.red)
            {
                teamRedCount++;
                teamRed.Add(player);
                Debug.Log(teamRedCount);
            }
            else
            {
                teamBlueCount++;
                teamBlue.Add(player);
                Debug.Log(teamBlueCount);
            }
        }

        if (PlayerMovement.localPlayerInstance == null)
        {
            if (PhotonNetwork.player.GetTeam() == PunTeams.Team.red)
            {
                spawn = spawnPointRed.transform.position;
            }
            else
            {
                spawn = spawnPointBlue.transform.position;
            }


            PhotonNetwork.Instantiate(playerPrefab.name, spawn, Quaternion.identity, 0);

            analytics = GameObject.FindGameObjectWithTag("Analytics").GetComponent <SendAnalyticInfo>();
        }
        //Handle adding bots into the game.
        if (PhotonNetwork.isMasterClient && localSettings.addBots == true)
        {
            for (int i = teamRedCount; i < 5; i++)
            {
                Debug.Log("adding red bot");
                // spawn bot
                GameObject bot = PhotonNetwork.Instantiate(botPrefab.name, new Vector3(0, 1000, 0), Quaternion.identity, 0) as GameObject;

                Text        botNameText = (Text)bot.GetComponentInChildren(typeof(Text));
                BOT_Profile bOT_Profile = (BOT_Profile)bot.GetComponent(typeof(BOT_Profile));
                botNameText.color = Color.red;
                bOT_Profile.GetAndSetBotName();
                botNameText.text = "[BOT]" + bOT_Profile.botName;

                bot.GetComponent <BOT_Profile>().red = true;

                if (bot.GetComponent <BOT_Profile>().red&& !bot.GetComponent <NavMeshAgent>().isOnNavMesh)
                {
                    bot.GetComponent <NavMeshAgent>().Warp(spawnPointRed.transform.position);
                }
                else
                {
                    bot.GetComponent <NavMeshAgent>().Warp(spawnPointBlue.transform.position);
                }



                teamRedCount++;
            }


            for (int i = teamBlueCount; i < 5; i++)
            {
                Debug.Log("adding blue bot");
                // spawn bot
                GameObject bot = PhotonNetwork.Instantiate(botPrefab.name, new Vector3(0, 1000, 0), Quaternion.identity, 0) as GameObject;

                //

                Text        botNameText = (Text)bot.GetComponentInChildren(typeof(Text));
                BOT_Profile bOT_Profile = (BOT_Profile)bot.GetComponent(typeof(BOT_Profile));
                botNameText.color = Color.blue;
                bOT_Profile.GetAndSetBotName();
                botNameText.text = "[BOT]" + bOT_Profile.botName;

                bot.GetComponent <BOT_Profile>().blue = true;

                if (bot.GetComponent <BOT_Profile>().red&& !bot.GetComponent <NavMeshAgent>().isOnNavMesh)
                {
                    bot.GetComponent <NavMeshAgent>().Warp(spawnPointRed.transform.position);
                }
                else
                {
                    bot.GetComponent <NavMeshAgent>().Warp(spawnPointBlue.transform.position);
                }
                teamBlueCount++;
            }
        }
    }