Skip to content

Instantly share code, notes, and snippets.

using System.Collections.Generic;
using UnityEngine;
public class DecalController : MonoBehaviour
{
[SerializeField]
[Tooltip("The prefab for the bullet hole")]
private GameObject bulletHoleDecalPrefab;
[SerializeField]
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Analytics;
public class MyGameNameHereAnalytics : MonoBehaviour
{
private void Start()
{
DontDestroyOnLoad(this.gameObject);
using UnityEngine;
using UnityEngine.Video;
public class VideoPlayerInput : MonoBehaviour
{
private VideoPlayer videoPlayer;
private void Awake()
{
videoPlayer = GetComponent<VideoPlayer>();
using UnityEngine;
public class AsteroidSpawner : MonoBehaviour
{
public int count = 10;
public GameObject prefab;
private void Start()
{
for (int i = 0; i < count; i++)
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)
using System;
using UnityEngine;
public class ScoreController
{
public event Action<int> OnScoreChanged = delegate { };
private int currentScore;
public void AddScore(int amountToAdd)
private void Awake()
{
InitializeDecals();
Shootable.OnAnyTookShot += (shootable, hit) => SpawnDecal(hit);
}
using UnityEngine;
public class ProjectileLauncher : MonoBehaviour
{
[SerializeField]
private Projectile prefab;
[SerializeField]
[Tooltip("Time in seconds between shots")]
private float fireDelay = 0.5f;
using System;
public interface IPoolable
{
event Action OnDestroyEvent;
}
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.")]