private void InitLogger() { StaRTS.Utils.Diagnostics.Logger logger = new StaRTS.Utils.Diagnostics.Logger(); UnityLogAppender unityLogAppender = null; logger.ErrorLevels = (LogLevel)3; logger.AddAppender(new BILogAppender(unityLogAppender)); logger.Start(); }
public Dispatcher(string url, MonoBehaviour engine, bool pickupMessages, IResponseHandler responseHandler) { this.url = url; this.engine = engine; this.pickupMessages = pickupMessages; this.SuccessStatuses = new HashSet <uint>(); this.SuccessStatuses.Add(0u); this.SuccessStatuses.Add(5001u); this.SuccessStatuses.Add(6300u); this.SuccessStatuses.Add(2202u); this.AuthKey = string.Empty; this.LastLoginTime = 0u; this.responseHandler = responseHandler; this.syncDispatchLock = false; this.logger = Service.Logger; this.qcc = Service.QuietCorrectionController; this.headers = this.GetDeviceInfoHeaders(); }
private void ResetAttackFSM(SmartEntity troopEntity) { StaRTS.Utils.Diagnostics.Logger logger = Service.Logger; StateComponent stateComp = troopEntity.StateComp; if (stateComp == null) { logger.Error("ResetAttackFSM StateComp is null"); return; } stateComp.Reset(); TroopComponent troopComp = troopEntity.TroopComp; if (troopComp == null) { logger.Error("ResetAttackFSM TroopComp is null"); return; } if (troopComp.TroopType == null) { logger.Error("ResetAttackFSM TroopVO is null"); return; } ShooterComponent shooterComp = troopEntity.ShooterComp; if (shooterComp == null) { logger.Error("ResetAttackFSM ShooterComp is null"); return; } TroopRole troopRole = shooterComp.ShooterVO.TroopRole; if (troopRole == TroopRole.None) { troopRole = shooterComp.OriginalShooterVO.TroopRole; } HealthType healthType = (troopRole != TroopRole.Healer) ? HealthType.Damaging : HealthType.Healing; shooterComp.Reset(); shooterComp.AttackFSM = new AttackFSM(Service.BattleController, troopEntity, troopEntity.StateComp, shooterComp, troopEntity.TransformComp, healthType); }
public AudioManager(AssetsCompleteDelegate onComplete) { Service.AudioManager = this; this.logger = Service.Logger; this.sdc = Service.StaticDataController; new AudioEventManager(this); this.audioObject = new GameObject("Audio"); this.audioObject.AddComponent <AudioListener>(); this.audioObject.transform.position = Vector3.zero; this.audioSources = new Dictionary <AudioCategory, AudioSource>(); this.audioSources[AudioCategory.Effect] = this.CreateAudioSource(128); this.audioSources[AudioCategory.Music] = this.CreateAudioSource(0); this.audioSources[AudioCategory.Ambience] = this.CreateAudioSource(10); this.audioSources[AudioCategory.Dialogue] = this.CreateAudioSource(20); this.loadedAudio = new Dictionary <AudioTypeVO, AudioData>(); this.fadeOutDictionary = new Dictionary <AudioSource, AudioFader>(); this.battleAudioFlags = new bool[8]; this.lastPlayed = new AudioTypeVO[4]; this.RefreshVolume(); this.PreloadAudioAssets(onComplete); }
private void SpawnProjectile(uint id, object cookie) { SpecialAttack specialAttack = (SpecialAttack)cookie; StaRTS.Utils.Diagnostics.Logger logger = Service.Logger; if (specialAttack == null) { logger.Error("SpawnProjectile: specialAttack is null"); this.SendSpecialAttackFired(null); return; } if (specialAttack.GetGunLocator() == null) { logger.Error("SpawnProjectile: specialAttack.GetGunLocator() is null " + specialAttack.VO.Uid); this.SendSpecialAttackFired(specialAttack.VO); return; } if (specialAttack.GetGunLocator().transform == null) { logger.Error("SpawnProjectile: specialAttack.GetGunLocator().transform is null " + specialAttack.VO.Uid); this.SendSpecialAttackFired(specialAttack.VO); return; } Vector3 position = specialAttack.GetGunLocator().transform.position; if (specialAttack.VO == null) { logger.Error("SpawnProjectile: specialAttack.VO is null"); this.SendSpecialAttackFired(specialAttack.VO); return; } float num = specialAttack.VO.NumberOfAttackers; int quantity = (int)((float)specialAttack.VO.Damage / num); specialAttack.ApplySpecialAttackBuffs(ref quantity); HealthFragment payload = new HealthFragment(null, HealthType.Damaging, quantity); ProjectileController projectileController = Service.ProjectileController; if (specialAttack.TargetShield != null && !specialAttack.VO.ProjectileType.PassThroughShield) { Entity shieldBorderEntity = specialAttack.TargetShield.ShieldBorderEntity; if (shieldBorderEntity == null) { logger.Error("SpawnProjectile: shieldTarget is null"); this.SendSpecialAttackFired(specialAttack.VO); return; } Vector3 targetWorldPos = specialAttack.TargetWorldPos; Vector3 targetWorldLoc = Vector3.zero; if (!Service.ShieldController.GetRayShieldIntersection(position, specialAttack.TargetWorldPos, specialAttack.TargetShield, out targetWorldLoc)) { targetWorldLoc = targetWorldPos; } Target target = Target.CreateTargetWithWorldLocation((SmartEntity)shieldBorderEntity, targetWorldLoc); int spawnBoardX = Units.WorldToBoardX((float)((int)position.x)); int spawnBoardZ = Units.WorldToBoardZ((float)((int)position.z)); projectileController.SpawnProjectileForTarget(specialAttack.VO.HitDelay, spawnBoardX, spawnBoardZ, position, target, payload, specialAttack.TeamType, null, specialAttack.VO.ProjectileType, false, specialAttack.SpecialAttackBuffs, specialAttack.VO.Faction, null); this.AddProjectileInFlight(specialAttack.VO.ProjectileType); } else { Bullet bullet = projectileController.SpawnProjectileForTargetPosition(specialAttack.VO.HitDelay, position, specialAttack.TargetBoardX, specialAttack.TargetBoardZ, payload, specialAttack.TeamType, null, specialAttack.VO.ProjectileType, specialAttack.SpecialAttackBuffs, specialAttack.VO.Faction, specialAttack.VO.HasDropoff); if (specialAttack.VO.HasDropoff) { bullet.Cookie = specialAttack; ProjectileView projectileView = Service.ProjectileViewManager.SpawnProjectile(bullet); Transform transform = projectileView.GetTransform(); this.AttachGameObject(transform, specialAttack.StarshipDetachableGameObject, false); specialAttack.UpdateDetachableShadowAnimator(SpecialAttackDetachableObjectState.Falling); } this.AddProjectileInFlight(specialAttack.VO.ProjectileType); } this.SendSpecialAttackFired(specialAttack.VO); }