public void SetMass(MassTypes massType, PlayerNumbers playerNumber) { if ( !(massType is MassTypes.Void) && playerNumber == this.speedController ) { GetComponent <Rigidbody>().mass = massType == MassTypes.Heavy ? this.heavyMass : this.lightMass; } }
// Update is called once per frame void Update() { MovementTypes movementType = Input.GetKey(this.moveForwardKeyboard) ? MovementTypes.Forward : Input.GetKey(this.moveBackwardKeyboard) ? MovementTypes.Backward : MovementTypes.Idle; this.move(movementType); MassTypes ballMassType = Input.GetKey(this.speedBallUpKeyboard) ? MassTypes.Light : Input.GetKey(this.speedBallDownKeyboard) ? MassTypes.Heavy : MassTypes.Void; Ball.Instance.SetMass(ballMassType, this.playerNumber); }
public void SetValue(double value, MassTypes type) { switch (type) { case MassTypes.Grams: _value = value; break; case MassTypes.Kilograms: _value = value * 1000; break; case MassTypes.Ounces: _value = value * 28.3495; break; case MassTypes.Pounds: _value = value * 453.592; break; } }
public Mass(double value, MassTypes type) { SetValue(value, type); }
public IBuilder SetMass(MassTypes mass) { this.pizza.Mass = mass; return(this); }