protected GhostRole(int roleDataIndex) { RoleListIndex = roleDataIndex; RoleData = GhostRoleManager.Instance.GhostRoles[roleDataIndex]; UpdateRole(RoleData.MinPlayers, RoleData.MaxPlayers, RoleData.Timeout); }
public void NewGhostRoleAvailable(GhostRoleData role) { ghostRoleSpriteHandler.SetSpriteSO(role.Sprite, Network: false); if (roleBtnAnimating) { return; // Drop rapid subsequent notifications } StartCoroutine(GhostRoleNotify(role)); }
/// <summary> /// Create a new ghost role instance on the server from the given ghost role data. /// The role availability will be broadcast to all dead players. /// </summary> /// <param name="roleData">The ghost role data to create the role with. Must be defined in GhostRoleList SO.</param> /// <returns>The key with which the new role was generated, for future reference, if successful.</returns> public uint ServerCreateRole(GhostRoleData roleData) { int roleIndex = GhostRoles.FindIndex(r => r == roleData); if (roleIndex < 0) { Logger.LogError( $"Ghost role \"{roleData}\" was not found in {nameof(GhostRoleList)} SO! Cannot inform clients about the ghost role."); return(default);
private IEnumerator GhostRoleNotify(GhostRoleData role) { roleBtnAnimating = true; Chat.AddExamineMsgToClient($"<size=48>Ghost role <b>{role.Name}</b> is available!</size>"); SoundManager.Play(SingletonSOSounds.Instance.Notice2); ghostRoleAnimator.TriggerAnimation(); yield return(WaitFor.Seconds(5)); ghostRoleSpriteHandler.ChangeSprite(0, Network: false); roleBtnAnimating = false; }