private static void Bot(ValueKeeper <int> grounded, Collider target, int duration) { if (target.Parent.Identifier == Identifier.Block) { grounded.SetValue(duration); } }
public static void Try(ValueKeeper <State> state, GameObject obj, ValueKeeper <int> hittingHead) { if (hittingHead > 0 && obj.Velocity.Y < 0) { state.SetValue(State.HeadBump); } }
public static void Try( InputController input , ValueKeeper <int> grounded , ValueKeeper <State> state) { if (grounded > 0 && (input.Jump.IsPressStaring || input.Jump.Heat > 0)) { state.SetValue(State.JumpStart); } }
public static void Try( InputController input , ValueKeeper <int> grounded , ValueKeeper <State> state) { if (!input.Left.IsPressed && !input.Right.IsPressed && grounded == Const.Grounded_Timer) { state.SetValue(State.Idle); } }
public static CollisionHandler Create(ValueKeeper <int> keeper, int duration) { handler = CollisionHandler.Create(); handler.Left = handler.Right = handler.Bot = handler.Top = (source, target) => Bot(keeper, target, duration); return(handler); }
public static void Try( InputController input , ValueKeeper <int> grounded , ValueKeeper <State> state , GameObject obj) { if ((input.Left || input.Right) && grounded == Const.Grounded_Timer && obj.Velocity.Y >= 0) { state.SetValue(State.Walking); } }
public static void Try( GameObject obj , InputController input , ValueKeeper <int> grounded , ValueKeeper <State> state) { if (!input.Jump.IsPressed && obj.Velocity.Y < 0 && obj.Velocity.Y < -Const.stoppingGravity) { state.SetValue(State.JumpBreak); } }
public static void Change( InputController input , ValueKeeper <bool> facingRight) { if (input.Left) { facingRight.SetValue(false); } else if (input.Right) { facingRight.SetValue(true); } }
void IShielded.Commit() { if (!_locals.HasValue) { return; } var newCurrent = _locals.Value; newCurrent.Older = _current; newCurrent.Version = _writerStamp.Version.Value; _current = newCurrent; _writerStamp = null; _locals.Release(); }
public static void Try( GameObject obj , ValueKeeper <int> grounded , ValueKeeper <int> hittingHead , ValueKeeper <State> state) { if (grounded == 0 && obj.Velocity.Y > 0) { state.SetValue(State.Fall); } else if (hittingHead > 0 && obj.Velocity.Y > -1000) { state.SetValue(State.Fall); } }
private ValueKeeper PrepareForWriting(bool prepareOld) { CheckLockAndEnlist(true); if (_current.Version > Shield.ReadStamp) { throw new TransException("Write collision."); } if (_locals.HasValue) { return(_locals.Value); } var v = new ValueKeeper(); if (prepareOld) { v.Value = CurrentTransactionOldValue().Value; } _locals.Value = v; return(v); }
/// <summary> /// Start this instance. /// </summary> void Start() { SetGameObjectForInitialization(); if (GameObject.Find("ValueKeeper")) { GameObject valueKeeperObject = GameObject.Find("ValueKeeper").gameObject; ValueKeeper valueKeeper = valueKeeperObject.GetComponent <ValueKeeper>(); Dictionary <string, UserState> userStateList = valueKeeper.UserStateList; foreach (KeyValuePair <string, UserState> eachUserState in userStateList) { if (eachUserState.Key.Contains("Player")) { playerStateList.Add(eachUserState.Key, eachUserState.Value); } } playerScreenshotList = valueKeeper.PlayerScreenshotList; if (playerStateList.Count > 0) { Dictionary <string, bool> checks = playerStateList.First().Value.CheckList; foreach (string check in checks.Keys) { checkTextList.Add(check); } } nextScene = valueKeeper.SceneAfterEvaluation; Destroy(valueKeeperObject); total.GetComponent <Text>().text = GetTotalComment(); MoveCheckBoxes(-1); } SoundController.instance.StartEvaluationSound(); }
/// <summary> /// Constructs a new Shielded container, containing the given initial value. /// </summary> /// <param name="initial">Initial value to contain.</param> /// <param name="owner">If this is given, then in WhenCommitting subscriptions /// this shielded will report its owner instead of itself.</param> public Shielded(T initial, object owner = null) { _current = new ValueKeeper(); _current.Value = initial; _owner = owner ?? this; }
/// <summary> /// Constructs a new Shielded container, containing default value of type T. /// </summary> /// <param name="owner">If this is given, then in WhenCommitting subscriptions /// this shielded will report its owner instead of itself.</param> public Shielded(object owner = null) { _current = new ValueKeeper(); _owner = owner ?? this; }
public static void Try(ValueKeeper <State> state) { state.SetValue(State.Jump); }