Notes
Notes - notes.io |
using System.Collections.Generic;
using UnityEngine;
[Flags]
public enum FInputDirection
{
Down = 1 << 0,
Up = 1 << 1,
Left = 1 << 2,
Right = 1 << 3,
}
[Flags]
public enum FInputButton
{
LP = 1 << 0,
MP = 1 << 1,
HP = 1 << 2,
LK = 1 << 3,
MK = 1 << 4,
HK = 1 << 5,
}
public class T : MonoBehaviour
{
private void Awake()
{
var dir = FInputDirection.Down | FInputDirection.Left;
var dirStr = Convert.ToString((int)dir, 2);
var btn = FInputButton.LK | FInputButton.MP | FInputButton.HK;
var btnStr = Convert.ToString((int)btn, 2);
//11010101 = 213
//Debug.Log(Enum.GetNames(typeof(FInputDirection)).Length + " " + dirStr + " " + btnStr);
//Debug.Log(Convert.ToString((213 / (int)Mathf.Pow(2, 1)), 2)); last bits
//first 4 : buttons
//last 4 : directions
var last4 = Convert.ToString(213 >> 4, 2);
var first4 = Convert.ToString(213 << 4, 2);
// Debug.Log(first4);
var d = new InputMotionStepItem_Direction();
d.BufferWindow = 12;
d.InputIDs = 1;
d.ShouldBeExactInput = true;
var df = new InputMotionStepItem_Direction();
df.BufferWindow = 12;
df.InputIDs = 3;
df.ShouldBeExactInput = true;
var f = new InputMotionStepItem_Direction();
f.BufferWindow = 12;
f.InputIDs = 2;
f.ShouldBeExactInput = true;
var p = new InputMotionStepItem_Button_All();
p.BufferWindow = 5;
p.HasNegativeEdge = true;
p.InputIDs = 4;
var inputMotionSteps = new List<IInputMotionStep>();
var inputMotionStep_d = new InputMotionStep();
inputMotionStep_d.InputMotionStepItems = new List<IInputMotionStepItem> { d };
inputMotionSteps.Add(inputMotionStep_d);
var inputMotionStep_df = new InputMotionStep();
inputMotionStep_df.InputMotionStepItems = new List<IInputMotionStepItem> { df };
inputMotionSteps.Add(inputMotionStep_d);
var inputMotionStep_f = new InputMotionStep();
inputMotionStep_f.InputMotionStepItems = new List<IInputMotionStepItem> { f };
inputMotionSteps.Add(inputMotionStep_f);
var inputMotionStep_p = new InputMotionStep();
inputMotionStep_p.InputMotionStepItems = new List<IInputMotionStepItem> { p };
inputMotionSteps.Add(inputMotionStep_p);
var inputMotion = new InputMotion
{
InputMotionSteps = inputMotionSteps
};
List<IInputMotion> inputMotions = new List<IInputMotion>();
inputMotions.Add(inputMotion);
}
}
public interface IInputMotion
{
int InputMotionID { get; set; }
List<IInputMotionStep> InputMotionSteps { get; set; }
}
public class InputMotion : IInputMotion
{
public int InputMotionID { get; set; }
public List<IInputMotionStep> InputMotionSteps { get; set; }
}
public interface IInputMotionStep
{
List<IInputMotionStepItem> InputMotionStepItems { get; set; }
}
public class InputMotionStep : IInputMotionStep
{
public List<IInputMotionStepItem> InputMotionStepItems { get; set; }
}
public interface IInputMotionStepItem
{
int InputIDs { get; set; }
int BufferWindow { get; set; }
bool IsMatched(int currentInputIDs);
}
public abstract class InputMotionStepItem_ButtonBase : IInputMotionStepItem
{
public int InputIDs { get; set; }
public int BufferWindow { get; set; }
public bool IsMatched(int currentInputIDs)
{
return true;
}
public abstract bool IsMatched();
public bool HasNegativeEdge { get; set; }
}
public class InputMotionStepItem_Button_All : InputMotionStepItem_ButtonBase
{
public int InputIDs { get; set; }
public int BufferWindow { get; set; }
public override bool IsMatched()
{
return true;
}
public bool HasNegativeEdge { get; set; }
}
public class InputMotionStepItem_Button_Any : InputMotionStepItem_ButtonBase
{
public int InputIDs { get; set; }
public int BufferWindow { get; set; }
public override bool IsMatched()
{
return true;
}
public bool HasNegativeEdge { get; set; }
public int AnyCount { get; set; }
}
public class InputMotionStepItem_Direction : IInputMotionStepItem
{
public int InputIDs { get; set; }
public int BufferWindow { get; set; }
public bool IsMatched(int currentInputIDs)
{
return true;
}
public bool ShouldBeExactInput { get; set; }
}
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team