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 TMPro; | |
using UnityEngine; | |
using UnityEngine.UI; | |
public class AnimatorPanel : MonoBehaviour | |
{ | |
[SerializeField] Animator _animator; | |
[SerializeField] Button _button; | |
void Start() |
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 the new Unity input system, | |
// a simple code that takes the player animation from a walk to a run if the _axisInput.x is held for 2 seconds. | |
// Something like this non working code where speed > 3 is run and less than 3 is walk and 2f is time the input key is held down: | |
// YES, we are very new at this lol | |
if (_axisInput.x >= Time.deltaTime * 2f) | |
_animator.SetFloat("Speed", 3); | |
else | |
else _animator.SetFloat("Speed", -.02f); |
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 BladeTrap : MonoBehaviour | |
{ | |
private void OnCollisionEnter(Collision collision) | |
{ | |
var enemy = collision.collider.GetComponentInParent<Enemy>(); | |
if (enemy == null) | |
return; |
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 Perf : MonoBehaviour | |
{ | |
[SerializeField] int _callsPerFrame = 10000; | |
void Update() | |
{ | |
for (int i = 0; i < _callsPerFrame; i++) | |
{ |
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 Bomb : MonoBehaviour | |
{ | |
[SerializeField] float _countdownTime = 5f; | |
[SerializeField] float _radius = 5f; | |
[SerializeField] int _damage = 5; |
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
int nextY = 0; | |
int direction = 1; | |
private void Update() | |
{ | |
if (nextY == 90 || nextY == 0) | |
direction *= -1; | |
nextY += direction; | |
var nextRotation = new Vector3(transform.rotation.eulerAngles.x, nextY, transform.rotation.eulerAngles.z); | |
transform.rotation = Quaternion.Euler(nextRotation); |
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.Generic; | |
using System.Linq; | |
using UnityEngine; | |
using UnityEngine.AddressableAssets; | |
using UnityEngine.ResourceManagement.AsyncOperations; | |
public class ParticleSpawner : MonoBehaviour | |
{ | |
[SerializeField] private List<AssetReference> _particleReferences; |
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
private void StickToMovingObjects() | |
{ | |
if(groundedObj != null){ | |
if(groundedObjLastPosition.HasValue && | |
groundedObjLastPosition.Value != groundedObj.position){ | |
//Determines the delta of the last position to the new position. | |
Vector3 delta = groundedObj.position - groundedObjLastPosition.Value; | |
//Moves the grounded object at the same rate as the groundedObj. | |
GetComponent<Rigidbody2D>().position += (Vector2)delta; | |
} |
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.IO; | |
namespace binarywritertest | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
byte[] data = new byte[100]; | |
for (byte i = 0; i < 100; i++) |
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.Generic; | |
using System.Linq; | |
using UnityEngine; | |
public class GameDataController : MonoBehaviour | |
{ | |
public static SaveData saveData; | |
private void Awake() | |
{ |
NewerOlder