Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben-Jammin curious-username

View GitHub Profile
View input_methods.cs
private void Awake()
{
_playerControls = new PlayerInputActions();
_bearAnim = GetComponent<Animator>();
}
private void OnEnable()
{
_movementActions = _playerControls.BearMovement.BearWalk;
_movementActions.Enable();
View gist:f18c2d15e7344573d4c6c49bac3af0dc
private void Awake()
{
_playerControls = new PlayerInputActions();
_bearAnim = GetComponent<Animator>();
}
private void OnEnable()
{
_movementActions = _playerControls.BearMovement.BearWalk;
_movementActions.Enable();
View input_variables.cs
Vector2 _bearMovement;
Animator _bearAnim;
PlayerInputActions _playerControls;
InputAction _movementActions;
InputAction _switchActionMap;
InputAction _RecoverActions;
View move.cs
if (Input.GetKeyDown(KeyCode.A))
{
Debug.Log("Adding v2: " + _greenCube.transform.position);
_greenCube.transform.position += v2;
}
else if (Input.GetKeyDown(KeyCode.S))
{
Debug.Log("Subtracting v2: " + _greenCube.transform.position);
_greenCube.transform.position -= v2;
}
View cameraswap.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class CameraSwap : MonoBehaviour
{
[SerializeField]
private CinemachineVirtualCamera[] cinemachineVirtualCameras;
private int _count = 0;
@curious-username
curious-username / POV.cs
Last active Mar 12, 2022
Basic Camera Movement
View POV.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class POV : MonoBehaviour
{
[SerializeField]
CinemachineVirtualCamera[] CameraController;
Transform overviewCameraTransform;
View bosspivot2.cs
void PivotCalculation()
{
Vector3 direction = Final_Boss.transform.position - transform.position;
direction.Normalize();
float rot_z = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, 0f, rot_z);
}
void LaserShootRight()
{
_direction = Vector3.down;
View BossLaserPivot1.cs
public class BossLaserPivot : MonoBehaviour
{
private GameObject Final_Boss;
Vector3 _direction = Vector3.down;
void Start()
{
Final_Boss = GameObject.Find("Final_Boss");
}
// Update is called once per frame
@curious-username
curious-username / heatseeking.cs
Created Jan 3, 2022
heat seeking requirement
View heatseeking.cs
public class TempMissile : MonoBehaviour
{
[SerializeField]
private GameObject[] _enemyLocations;
private GameObject _closestEnemy;
private float _enemyDistance = 1000f;
private float _speed = 3.5f;
// Start is called before the first frame update
void Start()
{
View enemy.cs
private bool _fireLaser = true;
void Update()
{
DestroyPowerup();
}
private void DestroyPowerup()
{
GameObject powerupObj = GameObject.FindGameObjectWithTag("Powerup");