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; | |
public class MoveToPlayer : MonoBehaviour | |
{ | |
public Transform player; | |
public float speed; | |
public float maxDistance; | |
void Update() | |
{ | |
if (Vector3.Distance(player.position, transform.position) < maxDistance) |
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
public class Achievements : MonoBehaviour | |
{ | |
//..More code here | |
private void Awake() | |
{ | |
Item.OnCollectedItem += HandleItemCollected; | |
} | |
private void OnDestroy() | |
{ |
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 UnityEngine; | |
namespace RoutineUtility | |
{ | |
/// <summary> | |
/// A routine utility that tracks whether a routine is still active or not | |
/// </summary> | |
public class Routine |
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
public void HandlePickup(GameCharacter character) | |
{ | |
DeactivatePowerUp(); | |
OnPickedUp?.Invoke(this, character); | |
} |
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
public void HandlePickup() | |
{ | |
DeactivatePowerUp(); | |
hideAnimation.Play(); | |
powerUpUI.Show() | |
soundManager.PlaySound(Sounds.PowerUp); | |
player.Pickup(this); | |
} |
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
public void HandlePickup(GameCharacter character) | |
{ | |
DeactivatePowerUp(); | |
hideAnimation.Play(); | |
if (character is Player) | |
{ | |
powerUpUI.Show() | |
soundManager.PlaySound(Sounds.PowerUp); | |
} | |
else |
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; | |
public static class VectorExtensions | |
{ | |
/// <summary> | |
/// Returns a modified version of the vector with one or more components modified | |
/// </summary> | |
/// <param name="x">X component to modify</param> | |
/// <param name="y">Y component to modify</param> | |
/// <returns>A modified version of the vector with the passed component configurations</returns> |