protected override void OnSetShip() { BattleBehaviour.AddEvent(() => { ship.team.myTeam = true; if (ui == null) { ui = GameObject.FindObjectOfType <PlayerUIManager>(); ui.GetRadar().SetDriver(this); uiBehaviour = ScreenManager.GetScreen <PlayerUIBehaviour>(); } var shipSystem = ship.shipSystem; ski = new ShipKeyInput(shipSystem); //Get camera from watcher watcher = GameObject.FindObjectOfType <WatcherBehaviour>(); watcher.target = ship.transform; camera = watcher.GetCamera(); //reset ui.SetAimPosition(aimPoint); everyTimeFire = false; everyTimeRotate = true; lockedEnemy = null; //SetAim(new Vector2(.5f, .7f)); BattleBehaviour.current.audioPlayer.SetListener(ship.transform); // audioPlayer is not initialized on start }); }
public ShipKeyInput(ShipSystem ship) { ui = ScreenManager.GetScreen <PlayerUIBehaviour>(); var shipSystem = ship; if (shipSystem.keys.Any()) { foreach (var k in shipSystem.keys) { components.Add(new KeyComponent(k.Key, k.Value)); } actions.component = components.First().component; ui.SetUI(shipSystem.keys.Select(p => new LinksGroup() { key = p.Key, link = p.Value, name = p.Value.item.lName }).ToArray()); UpdateView(); } }