Skip to content

Instantly share code, notes, and snippets.

View JonathanMCarter's full-sized avatar

Jonathan Carter JonathanMCarter

View GitHub Profile
var group = MultiSceneManager.ActiveSceneGroup;
[MultiSceneOrdered(-100)]
public void OnMultiSceneAwake()
{
// Some code here...
}
public void OnMultiSceneStart()
{
// Some code here...
}
public void OnMultiSceneEnable()
{
// Some code here...
}
public void OnMultiSceneAwake()
{
// Some code here...
}
private void OnEnable()
{
MultiSceneManager.BeforeScenesLoaded.Add(OnPreSceneLoad);
}
private void OnDisable()
{
MultiSceneManager.BeforeScenesLoaded.Remove(OnPreSceneLoad);
}
@JonathanMCarter
JonathanMCarter / Turret.cs (from C.W.I.S)
Created January 11, 2021 12:13
The turret base class used by the weapons on the ship in C.W.I.S, this controls the turret rotation towards the mouse & the object pooling for the bullets/missiles in the game.
using CarterGames.Utilities;
using CarterGames.Assets.AudioManager;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
/*
* Copyright (c) Jonathan Carter
* E: jonathan@carter.games
@JonathanMCarter
JonathanMCarter / UpdateCardVisuals Method in ScorecardButton.cs (Detective Notes)
Created January 11, 2021 12:09
The method that edits the visuals when a user selects an icon from the "editing" popup.
/// <summary>
/// Updates the card visual based on its status number...
/// </summary>
public void UpdateCardVisuals()
{
if (!status.Equals(0))
{
if (status.ToString().Length.Equals(1))
{
_icons[1].SetActive(false);
@JonathanMCarter
JonathanMCarter / Code Sample from Save Manager (SaveDataEditor.cs)
Last active January 11, 2021 12:10
The code the runs the display in the first tab of the Save Data Editor in the Save manager asset. It's purpose is to help the user name a class with savable values.
/// <summary>
/// Shows the Generate class display
/// </summary>
private void TabOneDisplay()
{
EditorGUILayout.HelpBox("Create a new SaveData class here.\n\nYou may just write it yourself, however if you wish " +
"for the asset to work with the data you want to save, we advise you use the provided editor to generate it. " +
"To begin, press the add field button, and repeat for each field you need. When done, press the Generate Class button.", MessageType.Info, true);
GUI.backgroundColor = Color.green;
@JonathanMCarter
JonathanMCarter / Google Sheet Script for Twine Save-Load Data (Snippet).js
Last active July 1, 2020 10:33
A snippet of a client project which needed to save and load words into multiple columns of a google sheet. Please contact me to get full script.
/*
Copyright (c) Jonathan Carter
E: jonathan@carter.games
W: https://jonathan.carter.games/
Twine harlowe google sheet saving and loading of single cells script
GET - returns the word or words up until the desired amount, or as many as there are if not enough
POST - adds the inputted word from twine to the sheet this script is linked to on the sheet defined below
*/
// Make sure this is the sheet you wish to write to... (default is 'DATA')