public PlayGameInitData( BotEntity botEntityPrefab, BotEntity botEntityPrefab2P, CameraFollower cameraFollower, PlayerHpPresenter playerHpPresenter, TileMapInfo tileMapInfo, RunButtonEvent runButtonEvent, ScriptText scriptText, BulletEntity bulletPrefab, ErrorMsg errorMsg, SoundManager soundManager, MeleeAttackEntity meleeAttackPrefab, ProcessScrollViewPresenter processScrollViewPresenter, EventSystemWatcher eventSystemWatcher) { this.botEntityPrefab = botEntityPrefab; this.botEntityPrefab2P = botEntityPrefab2P; this.cameraFollower = cameraFollower; this.playerHpPresenter = playerHpPresenter; this.tileMapInfo = tileMapInfo; this.runButtonEvent = runButtonEvent; this.scriptText = scriptText; this.bulletPrefab = bulletPrefab; this.errorMsg = errorMsg; this.soundManager = soundManager; this.meleeAttackPrefab = meleeAttackPrefab; this.processScrollViewPresenter = processScrollViewPresenter; this.eventSystemWatcher = eventSystemWatcher; }
public RemoteHostBotController(BotEntity botEntityPrefab, TileMapInfo tileMapInfo, BulletEntity bulletPrefab, SoundManager soundManager, GameSignalingClient gameSignalingClient, MeleeAttackEntity meleeAttackEntity, EventSystemWatcher eventSystemWatcher) { var botEntity = Object.Instantiate(botEntityPrefab); tileMapInfo.EnemyTankTransform = botEntity.transform; botEntity.gameObject.layer = LayerMask.NameToLayer("EnemyBot"); botEntity.transform.position = tileMapInfo.GetPlayer1StartPosition(); var botEntityAnimation = botEntity.GetComponent <BotEntityAnimation>(); MeleeAttackApplication meleeAttackApplication = new MeleeAttackApplication(meleeAttackEntity, soundManager); var gun = new Gun( soundManager, new BulletEntityCreator(bulletPrefab, LayerMask.NameToLayer("EnemyBullet")), true ); botApplication = new BotApplication.BotApplication( botEntity, botEntityAnimation, tileMapInfo, eventSystemWatcher, gun, meleeAttackApplication, true ); gameSignalingClient.ReceivedClientReceiveSignalData += data => { if (data.commandApplyTarget == MatchType.Host) { new BotCommandsTransformerService().FromCommandData(data.commandData, botApplication); } }; }
public BotApplication(BotEntity botEntity, BotEntityAnimation botEntityAnimation, TileMapInfo tileMapInfo, EventSystemWatcher eventSystemWatcher, Gun gun, MeleeAttackApplication.MeleeAttackApplication meleeAttackApplication, bool noPosFix = false) { this.botEntity = botEntity; botEntity.HitBulletEvent += (sender, e) => Hp = Hp.DamageHp(1); this.botEntityAnimation = botEntityAnimation; this.tileMapInfo = tileMapInfo; Hp = new BotHp(3); this.meleeAttackApplication = meleeAttackApplication; this.noPosFix = noPosFix; this.eventSystemWatcher = eventSystemWatcher; this.gun = gun; }
public ClientBotController(BotEntity botEntityPrefab, TileMapInfo tileMapInfo, BulletEntity bulletPrefab, CameraFollower cameraFollower, PlayerHpPresenter playerHpPresenter, RunButtonEvent runButtonEvent, ScriptText scriptText, ErrorMsg errorMsg, SoundManager soundManager, GameSignalingClient gameSignalingClient, MeleeAttackEntity meleeAttackEntity, ProcessScrollViewPresenter processScrollViewPresenter, EventSystemWatcher eventSystemWatcher) { this.errorMsg = errorMsg; this.playerHpPresenter = playerHpPresenter; var botEntity = Object.Instantiate(botEntityPrefab); tileMapInfo.PlayerTankTransform = botEntity.transform; botEntity.gameObject.layer = LayerMask.NameToLayer("PlayerBot"); cameraFollower.SetPlayerPosition(botEntity.transform); var botEntityAnimation = botEntity.GetComponent <BotEntityAnimation>(); botEntity.transform.position = tileMapInfo.GetPlayer2StartPosition(); MeleeAttackApplication meleeAttackApplication = new MeleeAttackApplication(meleeAttackEntity, soundManager); var gun = new Gun( soundManager, new BulletEntityCreator(bulletPrefab, LayerMask.NameToLayer("PlayerBullet")), false ); botApplication = new BotApplication.BotApplication( botEntity, botEntityAnimation, tileMapInfo, eventSystemWatcher, gun, meleeAttackApplication, true ); var hookBotApplication = new ClientBotCommandsHook(botApplication, gameSignalingClient); javaScriptEngine = new JavaScriptEngine.JavaScriptEngine(hookBotApplication); runButtonEvent.AddClickEvent(async() => { var tokenSource = new CancellationTokenSource(); var token = tokenSource.Token; var panel = processScrollViewPresenter.AddProcessPanel( () => { tokenSource.Cancel(); }); var task = javaScriptEngine.ExecuteJS(scriptText.GetScriptText(), token, panel.ProcessId); await task; panel.Dispose(); }); }
public CpuBotController(BotEntity botEntityPrefab, TileMapInfo tileMapInfo, BulletEntity bulletPrefab, SoundManager soundManager, MeleeAttackEntity meleeAttackEntity, EventSystemWatcher eventSystemWatcher) { var botEntity = Object.Instantiate(botEntityPrefab); tileMapInfo.EnemyTankTransform = botEntity.transform; botEntity.gameObject.layer = LayerMask.NameToLayer("EnemyBot"); botEntity.transform.position = tileMapInfo.GetPlayer2StartPosition(); var botEntityAnimation = botEntity.GetComponent <BotEntityAnimation>(); MeleeAttackApplication meleeAttackApplication = new MeleeAttackApplication(meleeAttackEntity, soundManager); var gun = new Gun( soundManager, new BulletEntityCreator(bulletPrefab, LayerMask.NameToLayer("EnemyBullet")), true ); botApplication = new BotApplication.BotApplication( botEntity, botEntityAnimation, tileMapInfo, eventSystemWatcher, gun, meleeAttackApplication ); cpuAi.Start(botApplication); }
public PlayerBotController(BotEntity botEntityPrefab, TileMapInfo tileMapInfo, BulletEntity bulletPrefab, CameraFollower cameraFollower, PlayerHpPresenter playerHpPresenter, RunButtonEvent runButtonEvent, ScriptText scriptText, ErrorMsg errorMsg, SoundManager soundManager, MeleeAttackEntity meleeAttackEntity, ProcessScrollViewPresenter processScrollViewPresenter, EventSystemWatcher eventSystemWatcher) { this.errorMsg = errorMsg; this.playerHpPresenter = playerHpPresenter; var botEntity = Object.Instantiate(botEntityPrefab); tileMapInfo.PlayerTankTransform = botEntity.transform; botEntity.gameObject.layer = LayerMask.NameToLayer("PlayerBot"); cameraFollower.SetPlayerPosition(botEntity.transform); var botEntityAnimation = botEntity.GetComponent <BotEntityAnimation>(); botEntity.transform.position = tileMapInfo.GetPlayer1StartPosition(); MeleeAttackApplication meleeAttackApplication = new MeleeAttackApplication(meleeAttackEntity, soundManager); var gun = new Gun( soundManager, new BulletEntityCreator(bulletPrefab, LayerMask.NameToLayer("PlayerBullet")), false ); botApplication = new BotApplication.BotApplication( botEntity, botEntityAnimation, tileMapInfo, eventSystemWatcher, gun, meleeAttackApplication ); javaScriptEngine = new JavaScriptEngine.JavaScriptEngine(botApplication); runButtonEvent.AddClickEvent(() => OnRunButtonClick(processScrollViewPresenter, scriptText)); }
public GetKeyCommandObject(EventSystemWatcher eventSystemWatcher, KeyCode keyCode) { this.eventSystemWatcher = eventSystemWatcher; this.keyCode = keyCode; }
public GetKeyUpCommandObject(EventSystemWatcher eventSystemWatcher, KeyCode keyCode) : base(eventSystemWatcher, keyCode) { }