예제 #1
0
 public PID_Runner(float pG, float iG, float dG,
                   float pMax, float pMin, float oMax, float oMin,
                   GetFloat pvFunc, GetFloat spFunc, SetFloat outFunc, float fixedTime)
 {
     pid            = new PID(pG, iG, dG, pMax, pMin, oMax, oMin, pvFunc, spFunc, outFunc);
     this.fixedTime = fixedTime;
 }
예제 #2
0
        static GameInfo()
        {
            MethodInfo wallJumpCheck          = typeof(Player).GetMethodInfo("WallJumpCheck");
            FieldInfo  strawberryCollectTimer = typeof(Strawberry).GetFieldInfo("collectTimer");
            FieldInfo  dashCooldownTimer      = typeof(Player).GetFieldInfo("dashCooldownTimer");
            FieldInfo  jumpGraceTimer         = typeof(Player).GetFieldInfo("jumpGraceTimer");
            FieldInfo  varJumpTimer           = typeof(Player).GetFieldInfo("varJumpTimer");
            FieldInfo  maxFall                  = typeof(Player).GetFieldInfo("maxFall");
            FieldInfo  playerSeekerSpeed        = typeof(PlayerSeeker).GetFieldInfo("speed");
            FieldInfo  playerSeekerDashTimer    = typeof(PlayerSeeker).GetFieldInfo("dashTimer");
            MethodInfo playerLiftSpeed          = typeof(Player).GetPropertyInfo("LiftBoost").GetGetMethod(true);
            FieldInfo  actorLiftSpeedTimer      = typeof(Actor).GetFieldInfo("liftSpeedTimer");
            FieldInfo  playerRetainedSpeed      = typeof(Player).GetFieldInfo("wallSpeedRetained");
            FieldInfo  playerRetainedSpeedTimer = typeof(Player).GetFieldInfo("wallSpeedRetentionTimer");
            FieldInfo  levelUnpauseTimer        = typeof(Level).GetFieldInfo("unpauseTimer");
            FieldInfo  currentCoroutine         = typeof(StateMachine).GetFieldInfo("currentCoroutine");
            FieldInfo  waitTimer                = typeof(Coroutine).GetFieldInfo("waitTimer");

            WallJumpCheck          = (DWallJumpCheck)wallJumpCheck.CreateDelegate(typeof(DWallJumpCheck));
            StrawberryCollectTimer = strawberryCollectTimer.CreateDelegate_Get <GetBerryFloat>();
            DashCooldownTimer      = dashCooldownTimer.CreateDelegate_Get <GetFloat>();
            JumpGraceTimer         = jumpGraceTimer.CreateDelegate_Get <GetFloat>();
            VarJumpTimer           = varJumpTimer.CreateDelegate_Get <GetFloat>();
            MaxFall                      = maxFall.CreateDelegate_Get <GetFloat>();
            PlayerSeekerSpeed            = playerSeekerSpeed.CreateDelegate_Get <GetPlayerSeekerSpeed>();
            PlayerSeekerDashTimer        = playerSeekerDashTimer.CreateDelegate_Get <GetPlayerSeekerDashTimer>();
            PlayerLiftBoost              = (Func <Player, Vector2>)playerLiftSpeed.CreateDelegate(typeof(Func <Player, Vector2>));
            ActorLiftSpeedTimer          = actorLiftSpeedTimer.CreateDelegate_Get <GetFloat>();
            PlayerRetainedSpeed          = playerRetainedSpeed.CreateDelegate_Get <GetFloat>();
            PlayerRetainedSpeedTimer     = playerRetainedSpeedTimer.CreateDelegate_Get <GetFloat>();
            LevelUnpauseTimer            = levelUnpauseTimer?.CreateDelegate_Get <Func <Level, float> >();
            StateMachineCurrentCoroutine = currentCoroutine.CreateDelegate_Get <Func <StateMachine, Coroutine> >();
            CoroutineWaitTimer           = waitTimer.CreateDelegate_Get <Func <Coroutine, float> >();
        }
예제 #3
0
 public void Reset()
 {
     FloatUpdate = null;
     IntUpdate   = null;
     V3Update    = null;
     ItemPool.Despawn(_text.gameObject);
 }
예제 #4
0
        public float Get(GetFloat getFloat)
        {
            float f;

            switch (getFloat)
            {
            case GetFloat.getTime: f = GetTime(); break;

            default: f = 0f;; break;
            }
            return(f);
        }
예제 #5
0
파일: PID.cs 프로젝트: tsuigrac/StatsRacer
 public PID(float pG, float iG, float dG,
            float pMax, float pMin, float oMax, float oMin,
            GetFloat pvFunc, GetFloat spFunc, SetFloat outFunc)
 {
     kp      = pG;
     ki      = iG;
     kd      = dG;
     pvMax   = pMax;
     pvMin   = pMin;
     outMax  = oMax;
     outMin  = oMin;
     readPV  = pvFunc;
     readSP  = spFunc;
     writeOV = outFunc;
 }
예제 #6
0
        static Manager()
        {
            MethodInfo wallJumpCheck       = typeof(Player).GetMethodInfo("WallJumpCheck");
            MethodInfo updateVirtualInputs = typeof(MInput).GetMethodInfo("UpdateVirtualInputs");

            FieldInfo strawberryCollectTimer = typeof(Strawberry).GetFieldInfo("collectTimer");
            FieldInfo dashCooldownTimer      = typeof(Player).GetFieldInfo("dashCooldownTimer");
            FieldInfo jumpGraceTimer         = typeof(Player).GetFieldInfo("jumpGraceTimer");
            FieldInfo playerSeekerSpeed      = typeof(PlayerSeeker).GetFieldInfo("speed");
            FieldInfo playerSeekerDashTimer  = typeof(PlayerSeeker).GetFieldInfo("dashTimer");


            Manager.UpdateVirtualInputs = (DUpdateVirtualInputs)updateVirtualInputs.CreateDelegate(typeof(DUpdateVirtualInputs));
            Manager.WallJumpCheck       = (DWallJumpCheck)wallJumpCheck.CreateDelegate(typeof(DWallJumpCheck));

            StrawberryCollectTimer = strawberryCollectTimer.CreateDelegate_Get <GetBerryFloat>();
            DashCooldownTimer      = dashCooldownTimer.CreateDelegate_Get <GetFloat>();
            JumpGraceTimer         = jumpGraceTimer.CreateDelegate_Get <GetFloat>();
            PlayerSeekerSpeed      = playerSeekerSpeed.CreateDelegate_Get <GetPlayerSeekerSpeed>();
            PlayerSeekerDashTimer  = playerSeekerDashTimer.CreateDelegate_Get <GetPlayerSeekerDashTimer>();
        }
예제 #7
0
        /// <summary>
        /// Gets a list of float values using a callback function.
        /// </summary>
        /// <param name="n">Number of floats to get.</param>
        /// <param name="getInt">Function to be called to get each float.</param>
        /// <returns>CSV list of floats.</returns>
        public static string GetFloatList(int n, GetFloat getFloat)
        {
            if (n == 0)
            {
                return(null);
            }
            string list = "";

            for (int i = 0; i < n; i++)
            {
                if (i > 0)
                {
                    list += ",";
                }
                float?value = getFloat(i);
                if (value != null)
                {
                    list += value.Value.ToString("0.0");
                }
            }
            return(list);
        }