This file contains hidden or 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.Generic; | |
using UnityEngine; | |
public class DecalController : MonoBehaviour | |
{ | |
[SerializeField] | |
[Tooltip("The prefab for the bullet hole")] | |
private GameObject bulletHoleDecalPrefab; | |
[SerializeField] |
This file contains hidden or 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.Generic; | |
using UnityEngine; | |
using UnityEngine.Analytics; | |
public class MyGameNameHereAnalytics : MonoBehaviour | |
{ | |
private void Start() | |
{ | |
DontDestroyOnLoad(this.gameObject); |
This file contains hidden or 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 UnityEngine.Video; | |
public class VideoPlayerInput : MonoBehaviour | |
{ | |
private VideoPlayer videoPlayer; | |
private void Awake() | |
{ | |
videoPlayer = GetComponent<VideoPlayer>(); |
This file contains hidden or 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; | |
public class AsteroidSpawner : MonoBehaviour | |
{ | |
public int count = 10; | |
public GameObject prefab; | |
private void Start() | |
{ | |
for (int i = 0; i < count; i++) |
This file contains hidden or 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; | |
public class Shootable : MonoBehaviour, ITakeShot | |
{ | |
public static event Action<Shootable, RaycastHit> OnAnyTookShot = (shootable, impactPoint) => { }; | |
public event Action<RaycastHit> OnTookShot = (impactPoint) => { }; | |
public void TakeShot(RaycastHit hit) |
This file contains hidden or 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; | |
public class ScoreController | |
{ | |
public event Action<int> OnScoreChanged = delegate { }; | |
private int currentScore; | |
public void AddScore(int amountToAdd) |
This file contains hidden or 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
private void Awake() | |
{ | |
InitializeDecals(); | |
Shootable.OnAnyTookShot += (shootable, hit) => SpawnDecal(hit); | |
} |
This file contains hidden or 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; | |
public class ProjectileLauncher : MonoBehaviour | |
{ | |
[SerializeField] | |
private Projectile prefab; | |
[SerializeField] | |
[Tooltip("Time in seconds between shots")] | |
private float fireDelay = 0.5f; |
This file contains hidden or 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; | |
public interface IPoolable | |
{ | |
event Action OnDestroyEvent; | |
} |
This file contains hidden or 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; | |
public class Projectile : MonoBehaviour, IPoolable | |
{ | |
[SerializeField] | |
protected float speed = 5f; | |
[SerializeField] | |
[Tooltip("How much damage it will do to a player on hit.")] |