public void ChangeMode(PlayerInput.PlayerInputState mode) { switch (mode) { case PlayerInput.PlayerInputState.Right: if (Mode != PlayerModes.Repel) { _playerMovement.StartCollectingEnergy(Mode); Mode = PlayerModes.Repel; OnPlayerSwitchedMode?.Invoke(Mode); } break; case PlayerInput.PlayerInputState.Left: if (Mode != PlayerModes.Attract) { _playerMovement.StartCollectingEnergy(Mode); Mode = PlayerModes.Attract; OnPlayerSwitchedMode?.Invoke(Mode); } break; default: _playerMovement.EndCollectingEnergy(Mode); Mode = PlayerModes.Passive; OnPlayerSwitchedMode?.Invoke(Mode); break; } }
public static void ConvertToSlotSystem(string name, PlayerModes mode) { string text = PlayerPrefsFile.GetPath(name); if (mode == PlayerModes.Multiplayer) { text += "MP"; } if (File.Exists(text)) { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, Slots.Slot1); if (!Directory.Exists(localSlotPath)) { Directory.CreateDirectory(localSlotPath); } File.Move(text, localSlotPath + name); } if (CoopSteamCloud.ShouldUseCloud() && CoopSteamCloud.CloudFileExist(name)) { Debug.Log("Converting cloud file: '" + name + "' to slot system"); byte[] buffer = CoopSteamCloud.CloudLoad(name); CoopSteamCloud.CloudDelete(name); if (CoopSteamCloud.CloudSave(SaveSlotUtils.GetCloudSlotPath() + name, buffer)) { Debug.Log(name + " converted successfully"); } else { Debug.Log(name + " update failed"); } } }
private int ReturnMaxPlayersforEachTeam(PlayerModes mode) { switch (mode) { case PlayerModes.ON1: return(1); case PlayerModes.ON2: return(2); case PlayerModes.ON3: return(3); case PlayerModes.ON4: return(4); case PlayerModes.ON5: return(5); case PlayerModes.ON6: return(6); case PlayerModes.ON7: return(7); case PlayerModes.ON8: return(8); default: return(1); } }
public string ReturnPlayerMode(PlayerModes mode) { switch (mode) { // #revision case (PlayerModes.ON1): return(PM_ON1); case (PlayerModes.ON2): return(PM_ON2); case (PlayerModes.ON3): return(PM_ON3); case (PlayerModes.ON4): return(PM_ON4); case (PlayerModes.ON5): return(PM_ON5); case (PlayerModes.ON6): return(PM_ON6); case (PlayerModes.ON7): return(PM_ON7); case (PlayerModes.ON8): return(PM_ON8); default: return("ReturnPlayerMode: playerMode not Defined"); } }
public void StartCollectingEnergy(PlayerModes mode) { if(Energy > 0) { EndCollectingEnergy(mode); } CollectsEnergy = true; }
private void Awake() { rb = this.GetComponent <Rigidbody2D>(); currentSprite = this.gameObject.GetComponent <SpriteRenderer>(); _currentMode = PlayerModes.InspectMode; _animator = GetComponent <Animator>(); targetPos = this.transform.position; }
public MediaPlayer(bool power, PlayerModes pm, bool discPresence, Sound sound, TrackControl trackControl, Mode mode) { Power = power; DiscPresence = discPresence; Sound = sound; TrackControl = trackControl; Mode = mode; Mode.CurrentMode = (UniversalMode)pm; }
public void OnPlayerSwitchedMode(PlayerModes mode) { if (mode == PlayerModes.Passive) { return; } SpendEnergy(); }
public static string GetCloudSlotPath(PlayerModes mode, Slots slot) { return(string.Concat(new object[] { mode, "_", slot, "_" })); }
public static string GetLocalSlotPath(PlayerModes mode, Slots slot) { return(string.Concat(new object[] { SaveSlotUtils.GetUserPath(), mode, "/", slot, "/" })); }
public int GetMultiplierFromMode(PlayerModes mode) { switch (mode) { case PlayerModes.Attract: return(1); case PlayerModes.Repel: return(-1); default: return(0); } }
public void OnPlayerChangeMode(PlayerModes mode) { switch (mode) { case PlayerModes.Attract: _meshRenderer.sharedMaterial = _greenMaterial; break; case PlayerModes.Repel: _meshRenderer.sharedMaterial = _redMaterial; break; case PlayerModes.Passive: _meshRenderer.sharedMaterial = _yellowMaterial; break; } }
public void ChangeColor(PlayerModes mode) { switch (mode) { case PlayerModes.Attract: _trailRenderer.startColor = Color.green; break; case PlayerModes.Repel: _trailRenderer.startColor = Color.red; break; default: _trailRenderer.startColor = Color.yellow; break; } }
public void ChangeSprite(PlayerModes mode) { switch (mode) { case PlayerModes.Attract: _spriteRenderer.sprite = _attractorModeSprite; break; case PlayerModes.Repel: _spriteRenderer.sprite = _repellerModeSprite; break; default: _spriteRenderer.sprite = _disabledModeSprite; break; } }
public static void DeleteSlot(PlayerModes mode, Slots slot) { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, slot); if (Directory.Exists(localSlotPath)) { SaveSlotUtils.DeleteDirectory(localSlotPath); } string[] array = CoopSteamCloud.ListFiles(); string cloudSlotPath = SaveSlotUtils.GetCloudSlotPath(mode, slot); for (int i = 0; i < array.Length; i++) { if (array[i].StartsWith(cloudSlotPath)) { CoopSteamCloud.CloudDelete(array[i]); } } }
private IEnumerator DEBUG_ToggleMode() { if (Input.GetKeyDown(KeyCode.Alpha1)) { if (_currentMode != PlayerModes.MovementMode) { _currentMode = PlayerModes.MovementMode; } } if (Input.GetKeyDown(KeyCode.Alpha2)) { if (_currentMode != PlayerModes.InspectMode) { _currentMode = PlayerModes.InspectMode; } } yield return(null); }
public void OnPlayerUsingControls(PlayerModes mode) { if (mode == PlayerModes.Passive) { transform.localScale = new Vector3(0, 0, 1); _spriteRenderer.enabled = false; if (_usingAbilityCoroutine != null) { StopCoroutine(_usingAbilityCoroutine); } } else { if (_usingAbilityCoroutine != null) { StopCoroutine(_usingAbilityCoroutine); } _usingAbilityCoroutine = StartCoroutine(UsingAbilityCoroutine()); } }
private void GetImpulse(PlayerModes mode) { if (Target != null) { Vector2 direction = transform.position - Target.transform.position; direction.Normalize(); _rigidbody.velocity = Vector2.zero; if(Vector2.Dot(direction, Target.transform.up) > (Mathf.Sqrt(3) / 2)) // cos(30*) = sqrt(3)/2 { direction = Target.transform.up; } Vector2 force = direction * Energy * 100f * Target.Parent.GetMultiplierFromType() * _playerControls.GetMultiplierFromMode(mode); force *= _impulseMultiplier; _rigidbody.AddForce(force, ForceMode2D.Impulse); //FORCE MODE (ATTRACTOR, REPELLER) } Energy = 0; }
public static void SetPlayerMode(PlayerModes mode) { GameSetup.Mode = mode; }
public _PlayerModes(PlayerModes Value, List <KeyCode> KeyButton) { this.Value = Value; this.KeyButton = KeyButton; }
void InitializePlayerModes() { PlayerModes.Add(new PlayerModeViewModel().Initialize(PlayerModeEnum.PlayerPlayer, "Two Players")); PlayerModes.Add(new PlayerModeViewModel().Initialize(PlayerModeEnum.PlayerDevice, "Single Player")); SelectedPlayerMode = PlayerModes[1]; }
public void EndCollectingEnergy(PlayerModes mode) { CollectsEnergy = false; GetImpulse(mode); }
public static void SyncWithCloud(string name, PlayerModes mode, Slots slot) { string localSlotPath = SaveSlotUtils.GetLocalSlotPath(mode, slot); string path = localSlotPath + name; string filename = SaveSlotUtils.GetCloudSlotPath(mode, slot) + name; bool flag = File.Exists(path); bool flag2 = CoopSteamCloud.CloudFileExist(filename); long num = 0L; long num2 = 0L; if (flag2 && flag) { num = CoopSteamCloud.CloudTimestamp(filename); num2 = File.GetCreationTime(path).ToUnixTimestamp(); flag2 = (num > num2); flag = (num < num2); } if (flag2) { if (num == 0L) { num = CoopSteamCloud.CloudTimestamp(filename); } Debug.Log(string.Concat(new object[] { "Syncing ", mode, "/", slot, "/", name, " from cloud(", num, ") to local(", num2, ")" })); if (!Directory.Exists(localSlotPath)) { Directory.CreateDirectory(localSlotPath); } File.WriteAllBytes(path, CoopSteamCloud.CloudLoad(filename)); File.SetCreationTime(path, DateEx.UnixTimeStampToDateTime(num)); File.SetLastWriteTime(path, DateEx.UnixTimeStampToDateTime(num)); Debug.Log(string.Concat(new object[] { "Local file (", name, ") Creation Time: ", File.GetCreationTime(path).ToUnixTimestamp(), " - ", num, " = ", File.GetCreationTime(path).ToUnixTimestamp() - num, "?" })); } else if (flag) { byte[] buffer = File.ReadAllBytes(path); bool flag3 = CoopSteamCloud.CloudSave(filename, buffer); Debug.Log(string.Concat(new object[] { "Cloud file (", name, ") Creation time: ", CoopSteamCloud.CloudTimestamp(filename), " - ", File.GetCreationTime(path).ToUnixTimestamp(), " = ", CoopSteamCloud.CloudTimestamp(filename) - File.GetCreationTime(path).ToUnixTimestamp(), "?" })); } }
public void OnSwitchedMode(PlayerModes mode) { _cameraShaker.Shake(); }