Skip to content

Instantly share code, notes, and snippets.

View GT3000's full-sized avatar

Anthony Delgado GT3000

View GitHub Profile
using System;
using UnityEngine;
using Cinemachine;
public class SecuritySystem : MonoBehaviour
{
[SerializeField] protected CinemachineBrain brain;
[SerializeField] protected CinemachineVirtualCamera[] virtualCams;
[SerializeField] protected CinemachineVirtualCamera thirdPersonCamera;
[SerializeField] protected bool inZone = false;
@GT3000
GT3000 / CameraController.cs
Last active December 27, 2022 22:04
Virtual Camera Switcher
using UnityEngine;
using Cinemachine;
public class CameraController : MonoBehaviour
{
[SerializeField] protected CinemachineVirtualCamera[] virtualCams;
void Update()
{
//Select vCam 1 and deprioritize rest
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//replacinig int with the T keyword allows you to use anything in the place of T
//however you must explicitly code the type into each implementation of IDamagable
public interface IDamagable<T>
{
T Health
{
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
//Once again calling IDamagable
public class Player : MonoBehaviour, IDamagable
{
public float speed = 100.0f;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//By inheiriting from IDamagable we are required to establish the interface properties and methods
public class EnemyInterface : MonoBehaviour, IDamagable
{
//property Health, now this enemy has a Health property that you can use
public int Health { get; set; }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//interfaces dont derive form anything
public interface IDamagable
{
//they only use properties which are empty since its just a "contract"
int Health
{
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Derives from Gold Distribution
public class Soldier : GoldDistribution
{
[SerializeField] private int unitSalary = 5000;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Derives from Gold Distribution
public class Mercenary : GoldDistribution
{
[SerializeField] private int contractLength = 1;
[SerializeField] private int contractRate = 10000;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class GoldDistribution : MonoBehaviour
{
[SerializeField] private string squadName;
[SerializeField] private string unitName;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Dictionary : MonoBehaviour
{
public Dictionary<int, Item> itemDictionary = new Dictionary<int, Item>();
void Start()
{