public Weapon(IReal wielder, Specs payload, Vector3 offset) : this(wielder, payload) { Angle = (float)Math.Atan2(offset.Y, offset.X); Length = new Vector2(offset.X, offset.Y).Length(); Depth = offset.Z; }
public Weapon(IReal wielder, Specs payload, float depth) : this(wielder, payload) { Angle = 0.0f; Length = 0.0f; Depth = depth; }
public MountedTurret(IReal wielder, Specs payload, Vector3 offset, float turnSpeed, float eleSpeed) : base(wielder, payload, offset) { TurnSpeed = turnSpeed; EleSpeed = eleSpeed; }
public MountedTurret(IReal wielder, Specs payload, float depth, float turnSpeed, float eleSpeed) : base(wielder, payload, depth) { TurnSpeed = turnSpeed; EleSpeed = eleSpeed; }
Check( IReal item ) { ValueReferenceException.Map( f => f.Parameter( "item" ), f => f.Down().Parameter( "item" ), () => Create().Check( item ) ); }
public Sprite(IReal parent) { Parent = parent; Textures = new List <Rectangle>(); for (int i = 0; i < 4; i++) { Textures.Add(new Rectangle(i * 32, 0, 32, 32)); } }
GetHashCode( IReal x ) { NonNull.CheckParameter( x, "x" ); return typeof( IReal ).GetHashCode() ^ x.GetValue().GetHashCode(); }
Create( IReal value ///< - <tt>NonNull</tt> /// - <tt>NonFractional</tt> ) { NonNull.CheckParameter( value, "value" ); NonFractional.CheckParameter( value, "value" ); return new DecimalInteger( value.GetValue() ); }
CheckParameter( IReal item, string paramName ) { ValueReferenceException.Map( f => f.Up().Parameter( paramName ), f => f.Down().Parameter( "item" ), () => Check( item ) ); }
Equals( IReal x, IReal y ) { if( x == null && y == null ) return true; if( x == null || y == null ) return false; if( object.ReferenceEquals( x, y ) ) return true; return x.GetValue() == y.GetValue(); }
Compare( IReal x, IReal y ) { if( x == null && y == null ) return 0; if( x == null ) return -1; if( y == null ) return 1; if( object.ReferenceEquals( x, y ) ) return 0; return x.GetValue().CompareTo( y.GetValue() ); }
protected void Fire(IReal shooter, Vector3 pos, Vector3 vel, Specs spec) { Shooter = shooter; Position = pos; Velocity = vel; Specification = spec; Gravitized = spec.Gravitized; Elasticity = spec.Elasticity; Aero = spec.Aero; Active = true; Bounces = 0; }
public static void Fire(IReal shooter, Vector3 pos, float angle, float elevation, Specs spec) { // TODO: really wish this could be implemented in the manager somehow Munition toFire; if (Registry.MunMan.Stored.Count > 0) { toFire = Registry.MunMan.Stored[0]; } else { toFire = new Munition(); } toFire.Fire(shooter, pos, Gizmo.VectorFromAngles(angle, elevation, spec.MuzzleVel), spec); Registry.MunMan.Add(toFire); }
DividedBy( this IReal dis, IReal that ///< - <tt>NonZero</tt> ) { NonNull.CheckParameter( dis, "dis" ); NonNull.CheckParameter( that, "that" ); NonZero.CheckParameter( that, "that" ); return Create( dis.GetValue() / that.GetValue() ); }
Times( this IReal dis, IReal that ) { NonNull.CheckParameter( dis, "dis" ); NonNull.CheckParameter( that, "that" ); return Create( dis.GetValue() * that.GetValue() ); }
public Sprite(IReal parent, List <Rectangle> textures) { Parent = parent; Textures = textures; }
protected Weapon(IReal wielder, Specs payload) { Wielder = wielder; Payload = payload; }
Test_InRange( RType< IReal > t, IReal min, IReal max, bool skipout ) { Print( "null passes" ); t.Check( null ); Print( "Smaller fails" ); if( !skipout ) Expect( e => RTypeException.Match( e, (vr,f) => vr.Equals( f.Down().Parameter( "item" ) ), rt => rt.Equals( t ) ), () => t.Check( min.Minus( Real.Create( 1m ) ) ) ); Print( "Min passes" ); t.Check( min ); Print( "In range passes" ); t.Check( Real.Create( 10 ) ); Print( "Max passes" ); t.Check( max ); Print( "Bigger fails" ); if( !skipout ) Expect( e => RTypeException.Match( e, (vr,f) => vr.Equals( f.Down().Parameter( "item" ) ), rt => rt.Equals( t ) ), () => t.Check( max.Plus( Real.Create( 1m ) ) ) ); }