public int this[FlagTypes flag] { //I tried doing this with an array of generic enums but it caused problems so its a switch statement for now get { switch (flag) { case FlagTypes.CommonFlags: return((int)commonFlags); case FlagTypes.ValueFlags: return((int)valueFlags); default: return(0); } } set { switch (flag) { case FlagTypes.CommonFlags: commonFlags = (CommonFlags)value; break; case FlagTypes.ValueFlags: valueFlags = (ValueFlags)value; break; } } }
public void Push(FlagTypes _type, bool _value) { foreach (FlagEntity fe in FlagsArray) { if (fe.Type == _type) { fe.Value = _value; break; } } }
public bool Pop(FlagTypes _type) { bool v = false; foreach (FlagEntity fe in FlagsArray) { if (fe.Type == _type) { v = fe.Value; break; } } return v; }
private void UpdateFlagPicture(FlagTypes flag) { uxCurrentFlag.Image = _flags[flag]; uxFlagTypeLabel.Text = flag.ToString().ToUpper(); if (flag != FlagTypes.None && flag != (FlagTypes)uxFlagHistory1.Tag) { uxFlagHistory3.Tag = uxFlagHistory2.Tag; uxFlagHistory3.Image = _flags[(FlagTypes)uxFlagHistory2.Tag]; uxFlagHistory2.Tag = uxFlagHistory1.Tag; uxFlagHistory2.Image = _flags[(FlagTypes)uxFlagHistory1.Tag]; uxFlagHistory1.Tag = flag; uxFlagHistory1.Image = _flags[flag]; } }
public int unpack(Reader reader, bool isPacked) { int pos = (int)reader.BaseStream.Position; info = (InfoTypes)reader.ReadByte(); byte flags = reader.ReadByte(); if (isPacked) { bool flag = info == InfoTypes.StateChange || info == InfoTypes.PassedTimeAttackGate; if ((flags & (byte)FlagTypes.InputChange) != 0 || flag) { inputs = reader.ReadByte(); } if ((flags & (byte)FlagTypes.PositionChange) != 0 || flag) { position.x = reader.ReadInt32(); position.y = reader.ReadInt32(); } if ((flags & (byte)FlagTypes.VelocityChange) != 0 || flag) { velocity.x = reader.ReadInt32(); velocity.y = reader.ReadInt32(); } if ((flags & (byte)FlagTypes.RotationChange) != 0 || flag) { rotation = reader.ReadByte() << 1; } if ((flags & (byte)FlagTypes.DirectionChange) != 0 || flag) { direction = (Directions)reader.ReadByte(); } if ((flags & (byte)FlagTypes.AnimationChange) != 0 || flag) { anim = reader.ReadByte(); } if ((flags & (byte)FlagTypes.FrameChange) != 0 || flag) { frame = reader.ReadByte(); } } else { inputs = reader.ReadByte(); position.x = reader.ReadInt32(); position.y = reader.ReadInt32(); velocity.x = reader.ReadInt32(); velocity.y = reader.ReadInt32(); rotation = reader.ReadInt32(); direction = (Directions)reader.ReadByte(); anim = reader.ReadByte(); frame = reader.ReadByte(); } this.flags = (FlagTypes)flags; return((int)reader.BaseStream.Position - pos); }
public FlagEntity(FlagTypes _type, bool _value, bool clean) { Type = _type; Value = _value; Clean = clean; }
public int GetActiveFlags(float time, FlagTypes flagType) { return((int)combinedFlagCurves[(int)flagType].Evaluate(time)); }
/*completed todo: its possible that instead of saving a list of curves I save one that is parsed into several. but figuring out how to do that could be a head ache*/ // turns out not as much of a pain as i thought, though it still needs some work to intigrate it better public int GetTrackedFlags(FlagTypes flag) { return(data[flag]); }