Beispiel #1
0
        public void CmdSpawnSpy()
        {
            GameManager.FactionInfo faction = GameMgr.Factions[FactionID];
            if (faction.team == 0)
            {
                Vector3 Pos = new Vector3(88, 2, 106);

                teamOneRpgSpy = Instantiate(teamOneRpgSpy);
                teamOneRpgSpy.SetActive(false);
                teamOneRpgSpy.transform.position = Pos;
                teamOneRpgSpy.SetActive(true);

                teamOneRpgSpy.transform.GetChild(1).gameObject.SetActive(false);
                NetworkServer.SpawnWithClientAuthority(teamOneRpgSpy, connectionToClient);
            }
            else
            {
                Vector3 Pos = new Vector3(22, 0, 34.3f);

                teamTwoRpgSpy = Instantiate(teamTwoRpgSpy);
                teamTwoRpgSpy.SetActive(false);
                teamTwoRpgSpy.transform.position = Pos;
                teamTwoRpgSpy.SetActive(true);
                teamTwoRpgSpy.transform.GetChild(1).gameObject.SetActive(false);

                NetworkServer.SpawnWithClientAuthority(teamTwoRpgSpy, connectionToClient);
            }
        }
Beispiel #2
0
 public void OnFactionWin(GameManager.FactionInfo FactionInfo)
 {
     if (DebugEnabled == true)
     {
         Debug.Log("Faction: " + FactionInfo.Name + " won the game.");
     }
     FactionWin(FactionInfo);
 }
Beispiel #3
0
 //Game events:
 public void OnFactionEliminated(GameManager.FactionInfo FactionInfo)
 {
     if (DebugEnabled == true)
     {
         Debug.Log("Faction: " + FactionInfo.Name + " has been eliminated from the game.");
     }
     FactionEliminated(FactionInfo);
 }
Beispiel #4
0
 //called whenever a faction is eliminated:
 void OnFactionEliminated(GameManager.FactionInfo factionInfo)
 {
     //if this is the current target faction?
     if (factionInfo.FactionMgr == targetFaction)
     {
         CancelAttack(); //cancel the attack
     }
 }
 //called when the maximum population slots are updated
 public void OnMaxPopulationUpdated(GameManager.FactionInfo factionInfo, int value)
 {
     //if this update belongs to the faction managed by this component:
     if (factionInfo.FactionMgr.FactionID == factionMgr.FactionID)
     {
         UpdateTargetAmount(factionInfo.GetMaxPopulation());
     }
 }
Beispiel #6
0
 public void OnMaxPopulationUpdated(GameManager.FactionInfo factionInfo, int value)
 {
     if (DebugEnabled == true)
     {
         Debug.Log(factionInfo.Name + " just updated its max population by " + value.ToString());
     }
     MaxPopulationUpdated(factionInfo, value);
 }
Beispiel #7
0
 //Population Events:
 public void OnCurrentPopulationUpdated(GameManager.FactionInfo factionInfo, int value)  //called when the current population of a faction is updated
 {
     if (DebugEnabled == true)
     {
         Debug.Log(factionInfo.Name + " just updated its current population by " + value.ToString());
     }
     CurrentPopulationUpdated(factionInfo, value);
 }
 public void OnMaxPopulationUpdated(GameManager.FactionInfo factionInfo, int value)
 {
     //if this update belongs to the faction managed by this component:
     if (factionInfo.FactionMgr.FactionID == factionMgr.FactionID)
     {
         maxPopulation = factionInfo.GetMaxPopulation();
         CheckFreePopulationSlots(factionInfo.GetFreePopulation());
     }
 }
Beispiel #9
0
        public void CmdCheckPlayerType()
        {
            GameManager.FactionInfo faction = GameMgr.Factions[FactionID];


            if (faction.playerType == "rpg" && faction.team == 0)
            {
                Vector3 Pos = new Vector3(88, 0, 106);

                rpgPlayerOne = Instantiate(rpgPlayerOne);
                rpgPlayerOne.SetActive(false);
                rpgPlayerOne.transform.position = Pos;
                rpgPlayerOne.SetActive(true);
                rpgPlayerOne.GetComponent <NavMeshAgent>().enabled = true;

                rpgPlayerOne.GetComponent <stats>().FactionId     = FactionID;
                rpgPlayerOne.GetComponent <stats>().Team          = faction.team;;
                rpgPlayerOne.GetComponent <stats>().StartPosition = Pos;
                NetworkServer.SpawnWithClientAuthority(rpgPlayerOne, connectionToClient);

                RpcCheckPlayerType(1, FactionID);
            }
            else if (faction.playerType == "rpg" && faction.team == 1)
            {
                Vector3 Pos = new Vector3(22, 2, 34.3f);
                rpgPlayerTwo = Instantiate(rpgPlayerTwo);
                rpgPlayerTwo.SetActive(false);
                rpgPlayerTwo.transform.position = Pos;
                rpgPlayerTwo.SetActive(true);
                rpgPlayerTwo.GetComponent <NavMeshAgent>().enabled = true;
                rpgPlayerTwo.GetComponent <stats>().FactionId      = FactionID;
                rpgPlayerTwo.GetComponent <stats>().FactionId      = FactionID;
                rpgPlayerTwo.GetComponent <stats>().Team           = faction.team;;
                rpgPlayerTwo.GetComponent <stats>().StartPosition  = Pos;
                NetworkServer.SpawnWithClientAuthority(rpgPlayerTwo, connectionToClient);

                RpcCheckPlayerType(2, FactionID);
            }
        }