Skip to content

Instantly share code, notes, and snippets.

View aviralgoel's full-sized avatar
🎯
Focusing

Aviral Goel aviralgoel

🎯
Focusing
View GitHub Profile
@aviralgoel
aviralgoel / CameraRotation.cs
Created October 29, 2022 02:14
Change Camera Rotation by User Input when Camera is Framing Transposer in Unity Cinemachine
// Problem Statment: Allow the player to modify camera orientation during runtime using key press
// Since Framing Transposer Virtual Camera Target Mode by default does not allow altering camera rotation
// This script works as solution
// After dropping the script into your project, add it to virtual camera through Virtual Camera Extention field
// in the Virtual Camera Gameobject
using UnityEngine;
using Cinemachine;
//using TryAgainFSM;
@aviralgoel
aviralgoel / FramingTransposerRotationAdjust.cs
Last active October 29, 2022 02:12
Unity Cinemachine Setting Virtual Camera Orientation when using Framing Transposer
// Problem Statement: When using Framing Transposer to follow a target via virtual camera
// framing transposer does not allow altering rotation of the camera.
// this script let us set a initial rotation of the camera and then allow us to manipulate vcam orientation during runtime
// no Aim target gameObject is necessary.
// After dropping the script into your project, add it to virtual camera through Virtual Camera Extention field
// in the Virtual Camera Gameobject
using UnityEngine;
using Cinemachine;
#include <iostream>
#include <vector>
using namespace std;
class Monster {
public:
int health;
int level;
char type;
#include <iostream>
#include <vector>
using namespace std;
class Monster {
public:
int health;
int level;
char type;
#include <iostream>
#include <vector>
using namespace std;
class myIncreasingFunctor {
int increaseBy;
public:
myIncreasingFunctor(int _value) {
increaseBy = _value;
@aviralgoel
aviralgoel / Functors.cpp
Created June 7, 2022 10:47
an example of functors in cpp
#include <iostream>
using namespace std;
class myIncreasingFunctor {
int increaseBy;
public:
myIncreasingFunctor(int _value) {
increaseBy = _value;
#include <iostream>
using namespace std;
// Solution #1 (BAD)
int IncreaseHealthBy50(int _hp)
{
return _hp + 100;
}
int IncreaseHealthBy60(int _hp)
@aviralgoel
aviralgoel / functionExample.cpp
Created June 7, 2022 10:22
an example of how a function looks like
#include <iostream>
using namespace std;
int IncreaseHealthBy50(int _hp)
{
return _hp + 100;
}
int main()
@aviralgoel
aviralgoel / doubly_linked_list.cpp
Created May 14, 2022 02:45
doubly_linked_list.cpp
#include <iostream>
#include <doubly_linked_list.h>
// constructor
template <typename T>
DoublyLinkedList<T>::DoublyLinkedList () {
this->head = nullptr;
this->tail = nullptr;
this->length = 0;
}
@aviralgoel
aviralgoel / doubly_linked_list.h
Created May 14, 2022 02:45
doubly_linked_list.h
#ifndef DOUBLY_LINKED_LIST_H_
#define DOUBLY_LINKED_LIST_H
/* Disclaimair: This is my first doubly linked list implementation.
** It is a bit rushed but I did my best to implement all the CRUD operations.
** Some of my functions are broken only in the sense that they do not perform checks for valid index value
** if the user provides wrong index value for node to be deleted, the function might break. (I had limited time, Sorry!)
** I urge you to improve my code and submit a pull request on GitHub!
*/
// a generic node class for aur doubly linked list