Skip to content

Instantly share code, notes, and snippets.

@ryanzec
ryanzec / AIController.cs
Last active May 19, 2019
Unity Utility Based AI Setup
View AIController.cs
using System.Collections.Generic;
using UnityEngine;
namespace UGPXFramework {
public class AIController {
private DynamicBlackboard _blackboard = new DynamicBlackboard();
private List<IAIScan> _scans = new List<IAIScan>();
private List<IAIAction> _actions = new List<IAIAction>();
public AIController(GameObject gameObject) {
@ryanzec
ryanzec / patterns.js
Created Mar 6, 2019
random frontend patterns
View patterns.js
// PATTERN
// avoid popup blocker when you need async code when opening new tab\
// NOTE: the downside to this approach it the the user will see a blank page until the async method finished but instead of opening
// NOTE: to a blank page, you could probably have a redirect page that has animation or something
//first have a method that does the async functionality and get passed in the new tab window
const doRedirect = async (newWindow) => {
try {
const redirectUrl = await api.getRedirectUrl();
@ryanzec
ryanzec / examples.cpp
Created May 29, 2018
c++ / sdl / etc examples
View examples.cpp
// @example scrolling example
case SDL_MOUSEMOTION:
{
bool mouseInUiNow = isInRect(sideUiBackground, event.motion.x, event.motion.y);
if (mouseInUiNow && !mouseInUi) {
mouseInUi = true;
} else if (!mouseInUiNow && mouseInUi) {
mouseInUi = false;
}
@ryanzec
ryanzec / .gitignore
Created Sep 11, 2017
Unity .gitignore file (Using Rider IDE)
View .gitignore
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
# Exclude 3rd party libraries installed from the assets store
[Aa]ssets/Asset Store Resources/
# Some asset tools can't be moved so need to explicitly
@ryanzec
ryanzec / .editorconfig
Created Aug 23, 2014
My standard editor config file
View .editorconfig
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
You can’t perform that action at this time.