View CalculateEntityClosestFOV.cs
void CalculateEntityClosestFOV(List<Entity> _listOfEntities) { | |
// We iterate through each item of the Entity list that was passed as an argument | |
foreach (var enemy in _listOfEntities) | |
{ | |
// If entity != null, proceed | |
if (enemy != null) | |
{ | |
// Get its position and set some constants that will create the quadrant around the entity: | |
Vector3 _entityLocation = new Vector3(enemy.entityLocation.x, enemy.entityLocation.y, 0); |
View h_msMethodAnalysis.cs
using System.Diagnostics; // enables System.Diagnostics.StopWatch | |
using System; // enables System.TimeSPan | |
Stopwatch stopwatch = new Stopwatch(); | |
stopwatch.Start(); | |
// Your function here | |
stopwatch.Stop(); | |
TimeSpan ts = stopwatch.Elapsed; |
View functions.php
function disable_wpcomtoolbar ( $modules ) { | |
if ( isset( $modules['masterbar'] ) ) { | |
unset( $modules['masterbar'] ); | |
} | |
return $modules; | |
} | |
add_filter( 'jetpack_get_available_modules', 'disable_wpcomtoolbar' ); |
View RoguelikeCameraController.cs
/* The main problem we try to solve here is that the Main Camera is a game object that is already in place before the Player Entity is generated, so it cannot be assigned as the Player instance is null */ | |
using UnityEngine; | |
public class CameraController : MonoBehaviour | |
{ | |
public Transform target; // The Player Transform | |
private bool isPlayerFound; | |
void Start() | |
{ |
View _debug_helper_functions.cs
private bool _debug_create_specific_item = true; | |
// DEBUG: When enabled, 100% chance to create a certain item each time x is triggered | |
if (_debug_create_specific_item) | |
{ | |
Debug.Log("###############------+ DEBUG MODE +-----###############"); | |
pickupItemObject = new GameObject("itemName"); | |
itemTag = "itemTag"; | |
SetupPickupItem(pickupItemObject, itemTag, itemSprite); |
View PlayerReceivesDamage.cs
## in PlayerCollisions.cs , attached to the player game object: | |
public bool isPlayerTakingDamage; | |
public void Start(){ | |
isPlayerTakingDamage = false; | |
} |
View FloatingTextController.cs
/* FloatingTextController.cs*/ | |
public class FloatingTextController : MonoBehaviour | |
{ | |
private static FloatingText popupText; | |
private static GameObject canvas; | |
public static void Initialize() |
View MapColorPulse.cs
IEnumerator MapColorPulse() | |
{ | |
bool isLimitReached = false; | |
map = GameObject.Find("Map"); | |
SpriteRenderer mapRendererComponent = map.GetComponent<SpriteRenderer>(); | |
initialMapAlphaValue = mapRendererComponent.color.a; // 1 | |
//Debug.Log("Initial alpha: " + initialMapAlphaValue); // 1 | |
// Test: Using Find() + new Color for setting up the alpha value: |
View AdManager.cs
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.Advertisements; | |
namespace Ngu | |
{ | |
public class AdManager : MonoBehaviour | |
{ |
View functions.php
/* Atomic V1 & V2 */ | |
if( ( defined( 'PRESSABLE_PROXY' ) && PRESSABLE_PROXY ) || ( defined( 'ATOMIC_PROXY' ) && ATOMIC_PROXY ) ) { | |
// Your code here | |
} |
NewerOlder