Skip to content

Instantly share code, notes, and snippets.

View SenpaiRar's full-sized avatar
🎯
Focusing

Tio Marello SenpaiRar

🎯
Focusing
View GitHub Profile
@SenpaiRar
SenpaiRar / Sleep_Clickable.cs
Last active May 13, 2019 16:16
This is the script that handles the player going to sleep. Alot of is dealing with the fade which I'll cover later.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Sleep_Clickable : ClickableParent
{
//DaycountManager is the manager that handles specifically the days system
public DayCountManager DayManager;
@SenpaiRar
SenpaiRar / Populator_Manager.cs
Created May 10, 2019 02:20
This is the manager of the populators we have on our Game Manager empty gameobject.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Populator_Manager : MonoBehaviour
{
//IMPORTANT: Dynamic means objects that can be interacted with (Zombies, Crates, etc.) Static means objects that can't be interacted with like grass or trees
//Here we have the four populators we created. We create a reference to each one so we can easily access them.
@SenpaiRar
SenpaiRar / Zombie_Populator.cs
Last active May 8, 2019 01:34
This populator places the zombies in the game world.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Zombie_Populator : MonoBehaviour {
//This determines how many packs of zombies will be spawned IE; how many clusters around the map, not how many zombie gameobjects
public int PackNumber;
//This determines how many zombie gameobjects are in each pack of zombies
@SenpaiRar
SenpaiRar / Crate_Populator.cs
Last active May 6, 2019 22:17
The Crate Populator handles placing crates around the map.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Crate_Populator : MonoBehaviour
{
//This list holds the crate prefabs we can spawn.
public List<GameObject> CrateSpawnables = new List<GameObject>();
@SenpaiRar
SenpaiRar / Detail_Populator.cs
Created May 6, 2019 21:07
This populator places object that should be placed in a uniform, random distribution, unlike the Environment populator which uses a noise map.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Detail_Populator : MonoBehaviour
{
//These two variables control how far the objects could potentially be placed.
//Ex. If these two variables were set to 20, the the farthest an object could be placed is at (20,0,20)
public float EndRangeX;
@SenpaiRar
SenpaiRar / Crate.cs
Last active May 4, 2019 04:29
This is the code that handles Crates. Notice how it inherits from ClickableParent, giving it the ability to be clicked on.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Crate : ClickableParent
{
public List<GameObject> ItemsInside = new List<GameObject>(); //A list is a collection of objects that can be accessed through a numbered list. In this case it holds our prefabs (Picture 1)
public int NumberOfItemsToSpawn; //This decides how many times we loop in OnClick(); IE it decides how many objects to spawn
public float MinimumDistance;
public AudioClip Clip;
@SenpaiRar
SenpaiRar / WaterScript.cs
Created May 2, 2019 04:29
This script is similar to the food script. It replenishes the player's water stat and then it deletes itself.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WaterScript : ClickableParent {
public string Name;
public float water_Value;
public float MinimumDistance;
private Player_Manager Master_Manager;
@SenpaiRar
SenpaiRar / FoodScript.cs
Created May 2, 2019 04:28
This script is an item script that replenishes the player's food and then deletes itself.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class FoodScript : ClickableParent {
public string Name;
public float food_Value;
public float MMinimumDistance;
@SenpaiRar
SenpaiRar / Modifier_Manager.cs
Last active May 2, 2019 04:13
The Modifer Manager is the script that takes every modifier and runs the four components inside each modifier.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Modifier_Manager : MonoBehaviour
{
public Player_Manager Player; //Every modifier needs a Player_Mangager, so we create one here instead of getting it for each modifier
public List<Modifier_Template> Debuffs = new List<Modifier_Template>(); //We create a list of modifiers
@SenpaiRar
SenpaiRar / Modifier_Template.cs
Last active May 2, 2019 02:38
This is the parent class of all modifiers. Every modifier we make will inherit from this class. The second file is an example of a completed modifier which slows the player down.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Notice how this class doesnn't inherit from Monobehaviour. This means we can't add this to gameobjects
public abstract class Modifier_Template
{
//By making all of these abstract, we force every modifier to have these functions
public abstract float Attribute { get; set; } //This is a property. We're essentially force every child to have a float number variabled named Attribute
//This attribute property usage depends on the modifier, but generally, it tells the modifier by how much to change a stat in Player_Manager