// 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(); }
/// <summary> /// In infection status is not shown all NCPs do no sprite update within the game /// since we do not want the user to know if they are healthy or not. /// Only when the game ends, we want them all to show their true color. /// *FIXME*: This is another function that does not really belong to the CreateHumans /// game object. But handling it in another way requires a lot more reconstruction than /// we want to do at the moment. /// </summary> protected override void CummulativeSpriteUpdate() { // all NPCs show true infection statuts CreateHumans.GetComponent <Components.CreatePopLeveldemo>().CummulativeSpriteUpdate(); // then start to update infection status again LevelSettings.GetActiveLevelSettings().ShowInfectionStatus = true; }
/// <summary> /// Runs after all other update calls, ensuring that lastDayTick gets updated AFTER all humans have called IsNewDay(). /// After all, we don't want a day to end early. /// </summary> void LateUpdate() { if (Time.time - lastDayTick > LevelSettings.GetActiveLevelSettings().DayLength) { lastDayTick = Time.time; } }
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(); }
/// <summary> /// Set stage of infection and update smiley's image /// </summary> public virtual void SetCondition(int condition) { _mycondition = condition; EndLevelControllerBase egc = LevelSettings.GetActiveEndLevelController(); // Update the stats switch (condition) { case EXPOSED: { egc.NotifyHumanExposed(); GetComponent <AbstractInfection>().Expose(); levelStats.aHumanGotExposed(); LevelSettings.GetActiveEndLevelController().infectionIsInitialized = true; break; } case INFECTIOUS: { levelStats.aHumanGotInfected(); break; } case DEAD: { // Removes this human's Rigidbody from the physics simulation, // which disables movement and collision detection. myRigidbody.simulated = false; // Set the simulated velocity to zero. myRigidbody.velocity = Vector3.zero; // Put this human's sprite on the 'Dead' sorting layer. // This layer is below the others, causing Dead humans to be rendered // below the living. GetComponent <SpriteRenderer>().sortingLayerName = "Dead"; egc.NotifyHumanRemoved(); levelStats.aHumanDied(myID); break; } case RECOVERED: { egc.NotifyHumanRemoved(); levelStats.aHumanRecovered(); break; } } // we want all the smileys to stay the same except for the player if (LevelSettings.GetActiveLevelSettings().ShowInfectionStatus == true || this.tag == "Player") { // Update the sprite image UpdateSpriteImage(); } }
// Awake is called the moment this component is created void Awake() { levelSettings = LevelSettings.GetActiveLevelSettings(); LevelSettings.GetActiveLevelSettings().NumberOfNPCs = 25; //This gets the Main Camera from the Scene MainCamera = Camera.main; // transform screen dimenensions into world space screenBounds = MainCamera.GetComponent <CameraResolution>().GetMapExtents(); PlaceHumans(); }
public void Start() { LevelSettings = LevelSettings.GetActiveLevelSettings(); // Get the statistics object that counts the number of infected humans // and initialize it. levelStats = LevelStats.GetActiveLevelStats(); // Reset the level stats if it was active. // This is necessary if we restart from a previous run. levelStats.Reset(); }
// Start is called before the first frame update void Awake() { // Make sure this object survives the scene change // We will need it in the end screen to evaluate the stats DontDestroyOnLoad(gameObject); // normally we initialize by the start-button-script from main menu // if this is no the case, we do the initialization here if (isInit == false) { LevelSettings LevelSettings = LevelSettings.GetActiveLevelSettings(); Init(LevelSettings.NumberOfNPCs); } }
public void Start() { m_coll = GetComponent <CircleCollider2D>(); // setting from main menu levelSettings = LevelSettings.GetActiveLevelSettings(); // adapt sd value from setting value (the latter is in %) sd = levelSettings.SocialDistancingFactor / 100; // we set social distancing by adjusting the radius of our collider SetSocialDistancingRadius(); // more social distancing makes us less bouncy // A value of 0 will not bounce. A value of 1 will bounce without any loss of energy. m_coll.sharedMaterial.bounciness = 1 - sd; // more social distancing makes us crave less friction m_coll.sharedMaterial.friction = 1 - sd; }
/// <summary> /// Calls the fail screen if the player is exposed /// </summary> /// <returns>True if the level ends</returns> protected bool EndGamePlayerExposed() { // if the player is exposed we fail if (CanvasFail != null && playerExposed && !playerInfectedByPropaganda) { // all NPCs show true infection statuts if (LevelSettings.GetActiveLevelSettings().ShowInfectionStatus == false) { CummulativeSpriteUpdate(); } CanvasFail.SetActive(true); FindAndPlaceHuman(CanvasFail); return(true); } return(false); }
// Awake is called the moment this component is created void Awake() { // get active level settings - the party scene always has 50% social distancing LevelSettings.GetActiveLevelSettings().SocialDistancingFactor = 50; // need this in every level LevelSettings.GetActiveLevelSettings().ShowInfectionStatus = true; LevelSettings.GetActiveLevelSettings().DayLength = 100f; // this gets the Main Camera from the Scene MainCamera = Camera.main; // place the humans PlaceHumans(); // player wears a mask and glasses in this level // human base calls SetCondition on start // where the right picture with mask and glasses is loaded Player.withGlassesAndMask = true; }
// 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(); }
/// <summary> /// Checks if a new simulated day has begun this frame. /// Call this only in Update() or FixedUpdate()! /// </summary> /// <returns>true if a new day has begun, false otherwise.</returns> public bool IsNewDay() { return(Time.time - lastDayTick > LevelSettings.GetActiveLevelSettings().DayLength); }
public void Start() { LevelSettings = LevelSettings.GetActiveLevelSettings(); }