Skip to content

Instantly share code, notes, and snippets.

View Pikachuxxxx's full-sized avatar
😎
Busy Innovating

Phani Srikar Pikachuxxxx

😎
Busy Innovating
View GitHub Profile
@Pikachuxxxx
Pikachuxxxx / NPC.cs
Created June 24, 2020 09:42
Unity Crowd NPC Behaviour
using UnityEngine;
using UnityEngine.AI;
public enum NPCType
{
Loner,
Herders,
Atteners
}
@Pikachuxxxx
Pikachuxxxx / Loner.cs
Created June 24, 2020 09:43
Unity Crowd NPC Behaviour - NPC type : Loner
using UnityEngine;
using UnityEditor;
public enum LonerStates
{
Moving,
Dying,
Exploring
}
@Pikachuxxxx
Pikachuxxxx / Internet Connection Manager.swift
Created June 24, 2020 13:41
Swift Internet Connection Manager
import SystemConfiguration // please import this module in Xcode Project.
/**
A class to check for internet connectivity in swift
*/
public class InternetConnectionManager {
//Initialiser Function
private init() {}
/**
A function to check for the internet connection availability in swift
@Pikachuxxxx
Pikachuxxxx / UICreator.swift
Created June 24, 2020 15:28
Swift class to manage and create UI Objects programatically
//
// UICreator.swift
// Canvas Drawing
//
// Created by phani srikar on 21/06/20.
// Copyright © 2020 phani srikar. All rights reserved.
//
import Foundation
import UIKit
@Pikachuxxxx
Pikachuxxxx / ReverseAnimation.cs
Created July 5, 2020 05:59
A Script To Reverse Your Unity Animation Clip
using UnityEditor;
using UnityEngine;
using System.IO;
public static class ReverseAnimationContext
{
[MenuItem("Assets/Create Reversed Clip", false, 14)]
private static void ReverseClip()
{
@Pikachuxxxx
Pikachuxxxx / PlayerMovement.cs
Created July 5, 2020 12:01
Simple TPP player movement in Unity
using UnityEngine;
using Cinemachine;
public class PlayerMovement : MonoBehaviour
{
public float lookSpeed = 1.5f;
public float moveSpeed = 5f;
public Camera cam;
private Vector3 moveDirection = Vector3.zero;
@Pikachuxxxx
Pikachuxxxx / RayCollisions.c
Last active April 22, 2024 12:32
A Function to Detect Collisions Between a Ray and a Rectangle and Dynamic Rectangle and a Rectangle in Raylib Environment
#include <stdio.h>
#include <raylib.h>
/*
* define this macro RAY_COLLISION_CALCULATION_DEBUG_STATS
* if you want to enable the ray collision calculations printed as debug data
*/
// helper functions
void SwapFloatValue(float *a, float *b){
@Pikachuxxxx
Pikachuxxxx / PlayerMovement2D.cs
Last active October 1, 2020 12:26
A simple and quick 2D Mario like jumping player movement script in Unity
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Rigidbody2D), typeof(BoxCollider2D))]
public class PlayerMovement2D : MonoBehaviour
{
private Rigidbody2D m_PlayerRB;
private float m_InputX;
private float m_InputY;
@Pikachuxxxx
Pikachuxxxx / OpenGL Init.cpp
Last active August 30, 2020 14:49
The Initialisation Code for Basic OpenGL Window
#include <iostream>
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
void glfw_initialisation_error(int error, const char* description){
std::cerr << "ERROR::INITIALISATION::GLFW::" << error << "::DESCRIPTION::" << description << std::endl;
}
@Pikachuxxxx
Pikachuxxxx / ImGuiEnableDocking.cpp
Created August 30, 2020 14:49
A snippet to enable ImGui Docking Feature with the necessary constrains
void ImGuiEnableDocking(bool* p_open)
{
static bool opt_fullscreen = true;
static bool opt_padding = false;
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
if (opt_fullscreen)