Beispiel #1
0
    public static LimitedFloat operator -(LimitedFloat argLHS, float argRHS)
    {
        LimitedFloat myLimitedFloat = new LimitedFloat(argLHS);

        myLimitedFloat.Current -= argRHS;
        return(myLimitedFloat);
    }
Beispiel #2
0
    protected override void implementation_setSimulationFromLogic(
        ISimulatableLogic inLogicToSetFrom)
    {
        CarPhysicsLogic theLogicToSetFrom = inLogicToSetFrom as CarPhysicsLogic;

        if (!theLogicToSetFrom)
        {
            //TODO: Make universal though for incorrect type casts
            throw new Exception("Simulation object has no compitable simulatable logic");
        }
        GameObject theGameObjectToSetFrom = theLogicToSetFrom.gameObject;

        //Set rigid body
        var theRigidBodyToSetFrom = theGameObjectToSetFrom.GetComponent <Rigidbody2D>();

        _rigidBody.angularVelocity = theRigidBodyToSetFrom.angularVelocity;
        _rigidBody.velocity        = theRigidBodyToSetFrom.velocity;

        //Set logic state
        _gasValue = theLogicToSetFrom._gasValue;
        _isGasWasChangedOnUpdate = theLogicToSetFrom._isGasWasChangedOnUpdate;

        _steeringWheelValue = theLogicToSetFrom._steeringWheelValue;
        _isSteeringWheelWasRotatedOnUpdate = theLogicToSetFrom._isSteeringWheelWasRotatedOnUpdate;
    }
Beispiel #3
0
    //-Implementation
    protected void Start()
    {
        _ammoInClip = new LimitedFloat(ClipSettings);

        _stateMachine = new SimpleStateMachine <State>(State.Idle);

        uiShootController = GetComponent <UIShootController>();
        if (uiShootController)
        {
            uiShootController.setClipStats(
                (int)_ammoInClip.getValue(), (int)_ammoInClip.getValue()
                );
        }
    }
Beispiel #4
0
 public LimitedFloat(LimitedFloat argCopy)
 {
     min     = argCopy.Min;
     max     = argCopy.Max;
     current = argCopy.Current;
 }
    void Reset()
    {
        distance = new LimitedFloat(3.0f, 1, 10);
        height = new LimitedFloat(1.0f, 1, 5);
        panX = new LimitedFloat(0.0f, -1, 1);
        panY = new LimitedFloat(0.0f, 0, 2);

        damping = 5.0f;
        rotationDamping = 10.0f;

        Controls.Add(new CameraControl(TargetEnum.Distance, MouseCodeEnum.ScrollWheel, 2));
        Controls.Add(new CameraControl(TargetEnum.Height, MouseCodeEnum.ScrollWheel, 1));
        Controls.Add(new CameraControl(TargetEnum.PanY, MouseCodeEnum.ScrollWheel, 0.5f));
        Controls.Add(new CameraControl(TargetEnum.PanX, KeyCode.LeftArrow, -1));
        Controls.Add(new CameraControl(TargetEnum.PanX, KeyCode.RightArrow, 1));
    }
Beispiel #6
0
 public static LimitedFloat operator -(LimitedFloat argLHS, float argRHS)
 {
     LimitedFloat myLimitedFloat = new LimitedFloat(argLHS);
     myLimitedFloat.Current -= argRHS;
     return myLimitedFloat;
 }
Beispiel #7
0
 public LimitedFloat(LimitedFloat argCopy)
 {
     min = argCopy.Min;
     max = argCopy.Max;
     current = argCopy.Current;
 }
Beispiel #8
0
 protected void implementation_initialize_state()
 {
     _gasValue           = new LimitedFloat(GasValueSettings);
     _steeringWheelValue = new LimitedFloatAngle(SteeringWheelValueSettings);
 }
Beispiel #9
0
 //-Implementation
 void Awake()
 {
     _buildPoints = new LimitedFloat(
         0.0f, getBuildingScheme().buildPointsToConstruct
         );
 }
Beispiel #10
0
 //-Implementation
 private void Start()
 {
     _hitPoints = new LimitedFloat(0.0f, MaxHitPoints, MaxHitPoints);
     _hitPoints.onAchievedMaximum += () => onAchievedMaxHitPoints?.Invoke();
     _hitPoints.onAchievedMinimum += () => onAchievedNoHitPoints?.Invoke();
 }