Beispiel #1
0
        private void FlagSetup()
        {
            flagSpawnPoint = FindObjectOfType <FlagSpawnPoint>();

            if (flagSpawnPoint != null)
            {
                BoltEntity entity = BoltNetwork.Instantiate(BoltPrefabs.Flag);
                flag = entity.GetComponent <Flag>();
                flag.flagSpawnPoint = flagSpawnPoint;
                flag.teamID         = flagSpawnPoint.teamID;
                flag.gameObject.AddComponent <FlagMotor>();

                ReturnFlagHome(flag, true);
            }
            else
            {
                Debug.LogError("No FlagSpawnPoint found");
            }
        }
Beispiel #2
0
        protected void FlagSetup()
        {
            foreach (FlagSpawnPoint flagSpawnPoint in FindObjectsOfType <FlagSpawnPoint>())
            {
                if (flagSpawnPoint.teamID == 1)
                {
                    flagSpawnPointTeam1 = flagSpawnPoint;

                    BoltEntity entity = BoltNetwork.Instantiate(BoltPrefabs.Flag);
                    flagTeam1 = entity.GetComponent <Flag>();
                    flagTeam1.flagSpawnPoint = flagSpawnPoint;
                    flagTeam1.teamID         = flagSpawnPoint.teamID;
                    flagTeam1.gameObject.AddComponent <FlagMotor>();

                    ReturnFlagHome(flagTeam1, true);
                }
                else if (flagSpawnPoint.teamID == 2)
                {
                    flagSpawnPointTeam2 = flagSpawnPoint;

                    BoltEntity entity = BoltNetwork.Instantiate(BoltPrefabs.Flag);
                    flagTeam2 = entity.GetComponent <Flag>();
                    flagTeam2.flagSpawnPoint = flagSpawnPoint;
                    flagTeam2.teamID         = flagSpawnPoint.teamID;
                    flagTeam2.gameObject.AddComponent <FlagMotor>();

                    ReturnFlagHome(flagTeam2, true);
                }
            }

            if (flagSpawnPointTeam1 == null)
            {
                Debug.LogError("No FlagSpawnPoint found for team 1");
            }

            if (flagSpawnPointTeam2 == null)
            {
                Debug.LogError("No FlagSpawnPoint found for team 2");
            }
        }