This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using Cinemachine; | |
public class CameraController : MonoBehaviour | |
{ | |
[SerializeField] protected CinemachineVirtualCamera[] virtualCams; | |
void Update() | |
{ | |
//Select vCam 1 and deprioritize rest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
//Derives from Gold Distribution | |
public class Soldier : GoldDistribution | |
{ | |
[SerializeField] private int unitSalary = 5000; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public abstract class GoldDistribution : MonoBehaviour | |
{ | |
[SerializeField] private string squadName; | |
[SerializeField] private string unitName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Dictionary : MonoBehaviour | |
{ | |
public Dictionary<int, Item> itemDictionary = new Dictionary<int, Item>(); | |
void Start() | |
{ |
NewerOlder