Exemple #1
0
        // Awake is called the moment this component is created
        void Start()
        {
            // player is in the house at the beginning
            PlayerHouse.GetComponent <PlayerHouse>().ShowPlayer();
            NPCs    = new List <NPC>(npcNumber);
            NPC_AIs = new List <NPC_AI>(npcAINumber);

            // get active level settings - the scene  has 18% social distancing
            LevelSettings.GetActiveLevelSettings().SocialDistancingFactor = 18;
            // our NPC number
            LevelSettings.GetActiveLevelSettings().NumberOfNPCs = npcNumber + npcAINumber;
            // time-scale is slow and infection status is not shown during game
            LevelSettings.GetActiveLevelSettings().DayLength           = 100f;
            LevelSettings.GetActiveLevelSettings().ShowInfectionStatus = false;
            // the grid cell has to be as large as the player's infection radius
            randomGridForHumans = GameObject.Find("RandomGrid").GetComponent <RandomGrid>();
            // generate the random coordinates for humans which depend on the scale of the player (who is largest),
            // their infection radius, since we do not want immediate infection
            // and the number of humans that we want to place
            randomGridForHumans.GenerateRandomCoords(3 * playerPrefab.transform.localScale.x,
                                                     playerPrefab.GetComponentInChildren <InfectionTrigger>().InfectionRadius,
                                                     npcNumber + npcAINumber);

            // place humans on grid (NPC, NPC_AI, player)
            CreateHumans();
            Player.withMask = true;

            // set the paths for the NPC_AIs
            // these are fixed floats at the moment
            // maybe there is a better more "relative" way do handle this
            SetPathsforNPC_AIs();
        }
Exemple #2
0
        void Start()
        {
            // player is not in the house at the beginning
            playerHouse.GetComponent <PlayerHouse>().UnshowPlayer();
            // get active level settings - the level demo scene has 18% social distancing
            LevelSettings.GetActiveLevelSettings().SocialDistancingFactor = 18;
            LevelSettings.GetActiveLevelSettings().NumberOfNPCs           = npcNumber;
            // We do not show the infection status in this level
            LevelSettings.GetActiveLevelSettings().ShowInfectionStatus = false;
            // Set the DayLength for this level
            LevelSettings.GetActiveLevelSettings().DayLength = 100;
            // this gets the Main Camera from the Scene
            // the grid cell has to be as large as the player's infection radius
            randomGridForHumans = GameObject.Find("RandomGrid").GetComponent <RandomGrid>();

            // generate the random coordinates for humans which depend on the scale of the player (who is largest),
            // their infection radius, since we do not want immediate infection
            // and the number of humans that we want to place
            randomGridForHumans.GenerateRandomCoords(playerPrefab.transform.localScale.x,
                                                     playerPrefab.GetComponentInChildren <InfectionTrigger>().InfectionRadius,
                                                     npcNumber);

            // place humans on grid
            CreateHumans();
        }
        void Start()
        {
            // player is in the house at the beginning
            playerHouse.GetComponent <PlayerHouse>().ShowPlayer();
            // Get reference to the nonSpanableSpace class
            nonSpawnableSpaceClass = nonSpawnableSpaceObj.GetComponent <nonSpawnableSpace>();
            // get active level settings - the get home scene always has 50% social distancing
            LevelSettings.GetActiveLevelSettings().SocialDistancingFactor = 18;
            LevelSettings.GetActiveLevelSettings().NumberOfNPCs           = npcNumber;
            // We do not show the infection status in this level
            LevelSettings.GetActiveLevelSettings().ShowInfectionStatus = false;
            // Set the DayLength for this level
            LevelSettings.GetActiveLevelSettings().DayLength = 100;
            // this gets the Main Camera from the Scene
            // the grid cell has to be as large as the player's infection radius
            randomGridForHumans = GameObject.Find("RandomGrid").GetComponent <RandomGrid>();
            // make screen Bounds 80% smaller so that NPCs are placed more in the middle since the player is at the edge
            randomGridForHumans.shrinkScreenBounds(0.8f);

            // generate the random coordinates for humans which depend on the scale of the player (who is largest),
            // their infection radius, since we do not want immediate infection
            // and the number of humans that we want to place
            randomGridForHumans.GenerateRandomCoords(playerPrefab.transform.localScale.x,
                                                     playerPrefab.GetComponentInChildren <InfectionTrigger>().InfectionRadius,
                                                     npcNumber, nonSpawnableSpaceClass);
            // place humans on grid
            CreateHumans();
        }
        // Start is called before the first frame update
        void Start()
        {
            // get number of NPCs from main menu
            levelSettings = LevelSettings.GetActiveLevelSettings();
            // in every level these should get a value, otherwise the value from previous level is adopted
            levelSettings.ShowInfectionStatus = true;
            levelSettings.DayLength           = 1f;

            npcNumber = levelSettings.NumberOfNPCs;
            // create our list of NPCs
            NPCs = new List <NPC>(npcNumber);
            // create the random grid with coordinates
            // the grid cell has to be as large as the player's infection radius
            randomGridForHumans = GameObject.Find("RandomGrid").GetComponent <RandomGrid>();
            // generate the random coordinates for humans which depend on the scale of the player (who is largest),
            // their infection radius, since we do not want immediate infection
            // and the number of humans that we want to place
            randomGridForHumans.GenerateRandomCoords(playerPrefab.transform.localScale.x,
                                                     playerPrefab.GetComponentInChildren <InfectionTrigger>().InfectionRadius,
                                                     npcNumber);
            // place humans on the grid
            CreateHumans();
        }