public static uint GetLength(PodState k) { return(LengthsForPodState.ContainsKey(k) ? LengthsForPodState[k] : TypesForPodState.ContainsKey(k) ? (Core.DataTypeLength(TypesForPodState[k]) > 0 ? Core.DataTypeLength(TypesForPodState[k]) : DefaultLength) : Core.DataTypeLength(DefaultType)); }
void Update() { FollowPlayer(); AimAtMouse(); batteryValue = currBattery; // Sets the batteryValue to the tracked current battery if (timerSpawnBullet > 0) { timerSpawnBullet -= Time.deltaTime; // if the timer is GREATER THAN 0, countdown the timer } switch (currentPodState) // State Switcher { case PodState.Regular: // Regular State: Follows player, depletes battery // Behavior currBattery -= Time.deltaTime; // Battery drops over time podStatus.text = ("ONLINE"); // UI tells player the pod is online // Transition if (Input.GetButton("Fire1")) { currentPodState = PodState.Shooting; } // If player presses "Left Click", switch to Shooting state if (Input.GetButtonDown("FollowerPower")) // If player presses "F"... { SoundBoard.PlayPlayerShieldOff(); // Play Player Shield Off Sound currentPodState = PodState.Charging; // Switch to charging state } if (currBattery <= batteryMin) // if current battery is LESS THAN or EQUAL TO minimum battery... { SoundBoard.PlayPlayerShieldOff(); // Play player shield off sound currentPodState = PodState.Charging; // switch to charging state } break; case PodState.Shooting: // Shooting State: Follows player, Shoots when player shoots, depletes battery // Behavior currBattery -= Time.deltaTime; // battery drops over time SpawnGoodBullet(); podStatus.text = ("FIRING"); // UI tells player the pod is firing // Transition if (!Input.GetButton("Fire1")) { currentPodState = PodState.Regular; } // If player is not left clicking, switch to regular state if (currBattery <= batteryMin) // if current battery is LESS THAN or EQUAL TO minimum battery... { SoundBoard.PlayPlayerShieldOff(); // Player player shield off sound currentPodState = PodState.Charging; // switch to charging state } break; case PodState.Charging: // Charging State: Follows player, charges battery // Behavior currBattery += Time.deltaTime * 1.5f; // current battery increases over time podStatus.text = ("CHARGING"); // UI tells player the pod is charging // Transition if (Input.GetButtonDown("FollowerPower")) // If player presses "F" { SoundBoard.PlayPlayerShieldOn(); // Play player shield on sound currentPodState = PodState.Regular; // Switch to regular state } if (currBattery >= batteryMax) { currentPodState = PodState.Off; } // If current battery is GREATER THAN or EQUAL TO maximum battery, switch to Off state break; case PodState.Off: // Off State: Do nothing // Behavior podStatus.text = ("OFFLINE"); // UI tells player the pod is offline // Transition if (Input.GetButtonDown("FollowerPower")) // If player presses "F" { SoundBoard.PlayPlayerShieldOn(); // Play player shield on sound currentPodState = PodState.Regular; // Switch to regular state } break; } }
public static Core.DataType GetType(PodState k) { return(TypesForPodState.ContainsKey(k) ? TypesForPodState[k] : DefaultType); }