Skip to content

Instantly share code, notes, and snippets.

View SenpaiRar's full-sized avatar
🎯
Focusing

Tio Marello SenpaiRar

🎯
Focusing
View GitHub Profile
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerShoot : MonoBehaviour
{
public List<WeaponObject> ListOfWeapons;
public AudioSource Audiosrc;
public AudioClip SwitchSound;
import requests
import RPi.GPIO as GPIO
import json
import time
#Openweather idCodes less than 700 are all precipitation
def CheckRain(IdCode):
if IdCode < 700:
return True
else:
return False
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public Rigidbody PlayerBody;
public float Speed;
public float FrictionalForce;
public Camera PlayerCam;
@SenpaiRar
SenpaiRar / MainMenuScript.cs
Created May 15, 2019 01:37
The script for the Main Menu.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//This package contains the commands for loading different scenes
using UnityEngine.SceneManagement;
public class MainMenuScript : MonoBehaviour
{
//This function starts the game by loading the scene with all our gameobjects
public void StartGame(){
StartCoroutine(StartLoadingScene());
@SenpaiRar
SenpaiRar / EscapeMenu.cs
Last active May 15, 2019 01:27
This is the script for the escape menu.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//We import Unity UI, but we also import something else!
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class EscapeMenu : MonoBehaviour
{
public KeyCode EscapeKey;
private bool EscapeMenuUp;
@SenpaiRar
SenpaiRar / Quad.ino
Last active May 14, 2019 18:18
This is the code for walking.
//Arduino provides a set of prebuilt code to run servos. To bring it into our code, we use this command.
#include <Servo.h>
//A class is a collection of differnet data and functions you can use to make coding more conveinent. In this case, we
//make a class that holds every servo on our robot so we can easily control it
class ServoManager{
public:
//Every servo on the robot is created in our class
Servo FrontRightThigh;
Servo FrontRightKnee;
@SenpaiRar
SenpaiRar / UIManager.cs
Last active May 14, 2019 19:48
This script goes on the canvas that holds the gameplay UI elements
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Because UI is a seperate package from Unity as a whole, we have to import using the using command.
using UnityEngine.UI;
public class UIManager : MonoBehaviour {
//We create Text objects in our script. The text we created earlier will be dragged into this script through the editor.
public Text HealthText;
@SenpaiRar
SenpaiRar / FoodScript.cs
Created May 14, 2019 15:19
Food items use the method I described above for audio because they're destroyed immediately as their clicked; we need to use on external audio source.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class FoodScript : ClickableParent {
public AudioSource Source;
public AudioClip Clip;
@SenpaiRar
SenpaiRar / Enemy_Zombie.cs
Created May 14, 2019 05:16
This is the script for the zombie. For this section, I've cut out most of the script to only include the audio portions.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy_Zombie : Entity_Parent {
//We create reference to the AudioSource that we can drag in because the zombies are a prefab
public AudioSource Source;
//This is the Audioclip of the zombie dying. Audio clips are made by downloading sounds from the internet and dragging them into the asset window
public AudioClip DieClip;
@SenpaiRar
SenpaiRar / DayCountManager.cs
Last active May 13, 2019 16:50
This DaycountManager takes care of changing the DifficultyLevel variable.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DayCountManager : MonoBehaviour
{
//This is the current day. We set it at 1 at the start
[HideInInspector]
public int CurrentDay;
//We make a Populator_Manager reference so we can drag the Populator_Manager and use its difficulty function