void Awake() { transPlayer = GetComponentInChildren<ObjPlayer>().transform; _instance = this; enabled = false;//모두 로드가 되면 endbled를 ture로 주는걸로 start. _savedTime = 0.0f; }
// Use this for initialization void Start () { stage = GameObject.FindGameObjectWithTag ("GameController").GetComponent<StageController> (); stage.deactive_Stage (8); boss = GameObject.FindGameObjectWithTag ("Boss"); player = GameObject.FindGameObjectWithTag ("Player"); move_script = player.GetComponent <ClickToMove_lvl2> (); skill_script = player.GetComponent <Skill_Controller> (); action_bar = GameObject.FindGameObjectWithTag ("ActionBar").GetComponent <ActionBarScript> (); move_script.teleport (position.transform.position); player.transform.position = position.transform.position; move_script.rotateToPos (boss.transform.position); move_script.enabled = false; skill_script.enabled = false; action_bar.enabled = false; dialogs[0] = Resources.Load<Texture2D>("Lvl2/Dialogs/boss_dialog_1"); dialogs[1] = Resources.Load<Texture2D>("Lvl2/Dialogs/boss_dialog_2_"+PlayerPrefs.GetString ("Player")); timer = Time.time + 3.5f; camera_timer = Time.time; }
// Use this for initialization void Start() { Instance = this; DialogDataAlert alert = new DialogDataAlert("START", "Game Start!", delegate() { Debug.Log ("OK Pressed"); }); DialogManager.Instance.Push(alert); }
// Use this for initialization void Start() { // Instance 변수에 현재 클래스의 인스턴스를 설정합니다. Instance = this; // 다이얼로그 데이터를 하나 생성합니다. 제목하고 내용, 그리고 콜백함수를 매개변수로 전달합니다. DialogDataAlert alert = new DialogDataAlert("START", "Game Start!", delegate() { Debug.Log ("OK Pressed"); }); // 생성한 Alert 다이얼로그 데이터를 DialogManager에 추가합니다. DialogManager.Instance.Push(alert); }
// Use this for initialization void Start () { time = 0; stageController = GameObject.Find ("Stage").GetComponent<StageController> (); mahoujinsPositions = new Vector2[stageController.mahojinsPos.Length]; for (int i = 0; i < stageController.mahojinsPos.Length; i++) { mahoujinsPositions [i] = stageController.mahojinsPos[i]; } mahojinControllers = new MahojinController[mahoujinsPositions.Length]; for (int i = 0; i < mahojinControllers.Length; i++) { mahojinControllers [i] = GameObject.Find ("mahojin" + i).GetComponent<MahojinController>(); } }
void Awake() { if(instance == null) { DontDestroyOnLoad(this.gameObject); instance = this; } else if(instance!= this) { Destroy(gameObject); } stageControl = GetComponent<StageController>(); }
void Awake() { PhotonRPCHandler.moveEvent += MoveEvent; PhotonRPCHandler.killEvent += KillEvent; if (GameManager.GetInstance().myInfo.id.ToString() == gameObject.name) { PhotonRPCHandler.startSyncEvent += StartSyncEvent; } else { PhotonRPCHandler.startSyncEvent += DummySyncEvent; } stage = GameObject.Find("Stage").GetComponent<StageController>(); ; }
// Use this for initialization void Start () { stage = GameObject.FindGameObjectWithTag ("GameController").GetComponent<StageController> (); stage.deactive_Stage (3); player = GameObject.FindGameObjectWithTag ("Player"); music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> (); demon_anim = demon.GetComponent<FireDemon_Controller> (); move_script = player.GetComponent <ClickToMove_lvl2> (); skill_script = player.GetComponent <Skill_Controller> (); move_script.enabled = false; skill_script.enabled = false; }
// Use this for initialization void Start () { time = 0; stageController = GameObject.Find ("Stage").GetComponent<StageController> (); mahoujinsPositions = new Vector2[stageController.mahojinsPos.Length]; for (int i = 0; i < stageController.mahojinsPos.Length; i++) { mahoujinsPositions [i] = stageController.mahojinsPos[i]; } mahojinControllers = new MahojinController[mahoujinsPositions.Length]; for (int i = 0; i < mahojinControllers.Length; i++) { mahojinControllers [i] = GameObject.Find ("mahojin" + i).GetComponent<MahojinController>(); } isHuman = GameManager.GetInstance ().myInfo.isHuman; akumaMode = false; }
// Use this for initialization void Start () { this.player = GameObject.FindGameObjectWithTag("Player"); this.player_script = player.GetComponent<CharacterScript> (); this.health_bar = this.gameObject.GetComponent<NPCHealthBar_lvl2> (); this.ctrl = GetComponent<CharacterController> (); this.stage = GameObject.FindGameObjectWithTag ("GameController").GetComponent<StageController> (); this.music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> (); this.respawn = transform.position; //this.health_bar.enabled = false; this.health_sphere = Resources.Load<GameObject> ("Lvl2/prefabs/Life_sphere_lvl2"); this.mana_sphere = Resources.Load<GameObject> ("Lvl2/prefabs/Mana_sphere_lvl2"); notAnim = !preanimation; setAtrributesDifficulty (PlayerPrefs.GetString ("Difficult")); state = 0; idleAnim (); }
private void Start() { speedText = GetComponent <Text>(); stageController = GameObject.FindObjectOfType <StageController>(); initSpeed = stageController.lowSpeed; }
void Awake() { gamestartGUI = GameObject.Find("gamestartGUI"); leaderboardCont = GameObject.Find("leaderboardGUI").GetComponent<LeaderBoardGUIController>(); gameoverGUI = GameObject.Find("gameoverGUI"); continueGUI = GameObject.Find("continueGUI"); continueGUI.SetActive(false); resultCont = GameObject.Find("Result").GetComponent<ResultController>(); player = GameObject.Find("Character").GetComponent<PlayerController>(); stageCont = GameObject.Find("AreaObjects").GetComponent<StageController>(); timerCont = GameObject.Find("Timer").GetComponent<TimerController>(); balloonCont = GameObject.Find("CurrentBalloon").GetComponent<CurrentBalloonController>(); bgCont = GameObject.Find("BackGround").GetComponent<BackGroundController>(); settings = gameObject.GetComponent<GameSettings>(); useBalloon = 1; //リーダーボードのIDセット. LEADERBOARD_ID = leaderboardId; FASGui.SetLeaderboardId(LEADERBOARD_ID); }
// Use this for initialization void Start() { addEnemy = GameObject.FindGameObjectWithTag("CardInventory").GetComponent <AddEnemy> (); sc = GameObject.FindGameObjectWithTag("StageDisplay").GetComponent <StageController>(); eHealth = sc.currentStage * 100; }
private bool _BolSlowKeyFlag = false; //低速按键标记 void Awake() { ScInstantce = this;//本脚本的静态单例实例化 }
// Use this for initialization void Start() { // Instance 변수에 현재 클래스의 인스턴스를 설정합니다. Instance = this; }
//=============public virtual============== //把主觀卡附加上去 public virtual void SetStageController(StageController controller) { _stageController = controller; }
private void Start() { stage = GetComponentInParent <StageController>(); }
private void Awake() { Instance = this; StartCoroutine(ShowAlert()); }
public void CloseCurtains(string unused) { StageController stageController = GameObject.Find("Stage").GetComponent <StageController>(); stageController.CloseCurtains(); }
public Window Execute(IDocument document, string[] args) { var hack = new ReplaySubject <IObservable <BytecodeGenerated> >(1); var project = new LiveProject(document, _shell, hack.Switch().ObserveOn(Application.MainThread)); var ignore = RecentProjects.Bump(document, project.Name.ObserveOn(Application.MainThread)); var preview = _previewService.StartPreview(project); hack.OnNext(preview.Bytecode); #pragma warning disable 0219 var garbage = ExternalSelection.UpdateProjectContext(_daemon, project); #pragma warning restore 0219 var inspector = Fuse.Inspector.Inspector.Create(project); var buildArgs = new BuildArgs(args); var usbMode = new USBMode(new AndroidPortReverser(), Observable.Return(preview.Port), _previewService); var previewOnDevice = new PreviewOnDevice(_fuse, project, buildArgs); var build = new Build(project, preview, previewOnDevice, usbMode.EnableUsbModeCommand, buildArgs); var export = new Export(project, _fuse, buildArgs); var projHost = new ProjectHost(build.BuildArguments, preview, project, self => _projectsOpen.OnNext(_projectsOpen.Value.Remove(self))); _projectsOpen.OnNext(_projectsOpen.Value.Add(projHost)); var codeView = new CodeView(preview.AccessCode, NetworkHelper .GetInterNetworkIps() .ToArray()); // Viewport stuff var selectionEnabled = Property.Create(false); var glVersion = new Subject <OpenGlVersion>(); var viewport = new ViewportFactory( preview, selectionEnabled, preview.Port, project, _fuse, glVersion); var mode = UserSettings.Enum <Mode>("WindowMode").Or(Mode.Normal); var previewDevices = new PreviewDevices(project, _shell); var workspace = new StageController( viewport, previewDevices, selectionEnabled); var topMost = Property.Create(false); var windowMenu = Menu.Toggle( name: "Compact mode", toggle: mode.Convert( convert: m => m == Mode.Compact, convertBack: b => b ? Mode.Compact : Mode.Normal), hotkey: HotKey.Create(ModifierKeys.Meta, Key.M)) + Menu.Separator + Menu.Toggle( name: "Keep window on top", toggle: topMost, hotkey: HotKey.Create((_fuse.Platform == OS.Windows ? ModifierKeys.Shift : ModifierKeys.Alt) | ModifierKeys.Meta, Key.T)) + Menu.Separator + Menu.Option( value: Themes.OriginalLight, name: "Light theme", property: Theme.CurrentTheme) + Menu.Option( value: Themes.OriginalDark, name: "Dark theme", property: Theme.CurrentTheme); var messages = preview.Messages.Replay(TimeSpan.FromSeconds(2)).RefCount(); project.FilePath.SubscribeUsing(projPath => PushEventsToDaemon.Start( messages: messages, daemon: _daemon, projectPath: projPath, projectId: ProjectIdComputer.IdFor(projPath), target: BuildTarget.DotNetDll)); var sketchConverter = new SketchWatcher(_fuse.Report, _shell); var classExtractor = new ClassExtractor(project); var buildStartedOrLicenseChanged = project.FilePath .CombineLatest(build.Rebuilt.StartWith(Unit.Default)); var allLogMessages = messages.ToLogMessages() .Merge(_setupGuide.LogMessages) .Merge(export.LogMessages) .Merge(project.LogMessages) .Merge(previewOnDevice.LogMessages) .Merge(classExtractor.LogMessages) .Merge(_hostRequestMessages) .Merge(_errors.Select(e => e.Message)) .Merge(AutoReload.Log.Select(msg => "[Fusion AutoReload]: " + msg) .Merge(glVersion.Take(1).ToLogMessages(_fuse.Report))) .Merge(preview.LogMessages) .Merge(_previewService.LogMessages) .Merge(sketchConverter.LogMessages) .Merge(previewDevices.LogMessages); var stopPreview = preview.Start(build.BuildArguments); // start with a viewport workspace.NewViewport.ExecuteOnce(); var projectMenu = ProjectMenu.CommandItems(project.FilePath.Select(Optional.Some), _shell) + Menu.Separator + ProjectMenu.FileItems(project, _shell) + Menu.Separator + Menu.Item("Sketch import", sketchConverter.ShowDialog()); var help = new Help(); var debug = new Debug(project); var elementContext = new ElementContext(project.Context, project, _daemon); var errorView = new ErrorView(messages, project.FilePath, _daemon, preview.ClientRemoved); var logView = new LogView(allLogMessages, messages, errorView); var sketchWatch = sketchConverter.Watch(project); var window = MainWindow.Create( projectName: project.Name, search: Control.Empty, //search.Control, outline: CreateLeftPane(project, elementContext, project.Context, _shell, classExtractor), bookmarks: Control.Empty, stage: workspace, notifications: Layout.StackFromTop( SimulatorNotifications.CreateBusyIndicator(messages), SimulatorNotifications.Create(messages, build.Rebuild, logView.IsExpanded)), inspector: inspector, attributes: Control.Empty, //DataContext.Create(workspace.Viewport, selection.Element), logview: logView, menu: MainMenu.Create( _fuse, _shell, workspace, help, elementContext.CreateMenu(project.Context.CurrentSelection), projectMenu, build, export, _setupGuide, windowMenu, debug), closed: Command.Enabled(() => { stopPreview.Dispose(); preview.Dispose(); projHost.Dispose(); project.FilePath.Take(1).Subscribe(path => _daemon.Broadcast(new ProjectClosed { ProjectId = ProjectIdComputer.IdFor(path) })); project.Dispose(); workspace.Dispose(); sketchWatch.Dispose(); }), selectionEnabled: selectionEnabled, topMost: topMost, mode: mode, mainWindowFocused: _mainWindowFocused.Update(Unit.Default), context: project.Context, codeView: codeView); return(window); }
private void OnDestroy() { instance = null; }
private void Start() { gateObserver = transform.parent.gameObject.GetComponent <GateObserver>(); stageController = GameObject.Find("StageController").GetComponent <StageController>(); playerController = GameObject.FindWithTag("Player").GetComponent <playerController>(); }
void Awake() { instance = this; //Find traits string microgameID = gameObject.scene.name; int difficulty = int.Parse(microgameID.Substring(microgameID.Length - 1, 1)); if (microgameID.Equals("Template")) { microgameID = "_Template1"; } microgameID = microgameID.Substring(0, microgameID.Length - 1); //Get traits from collection if available if (GameController.instance != null) { var collectionMicrogame = MicrogameHelper.getMicrogames(includeBosses: true).FirstOrDefault(a => a.microgameId.Equals(microgameID)); if (collectionMicrogame != null) { traits = collectionMicrogame.difficultyTraits[difficulty - 1]; } } //Get traits from project file if necessary if (traits == null) { traits = MicrogameTraits.findMicrogameTraits(microgameID, difficulty); } debugMode = GameController.instance == null || GameController.instance.getStartScene() == "Microgame Debug"; if (debugMode) { //Debug Mode Awake (scene open by itself) if (MicrogameDebugObjects.instance == null) { SceneManager.LoadScene("Microgame Debug", LoadSceneMode.Additive); } else { MicrogameDebugObjects.instance.Reset(); } if (preserveDebugSpeed > -1) { Debug.Log("Debugging at speed " + preserveDebugSpeed); debugSettings.speed = preserveDebugSpeed; preserveDebugSpeed = -1; } StageController.beatLength = 60f / 130f; Time.timeScale = StageController.getSpeedMult(debugSettings.speed); victory = traits.defaultVictory; victoryDetermined = false; traits.onAccessInStage(microgameID, difficulty); } else if (!isBeingDiscarded()) { //Normal Awake StageController.instance.stageCamera.tag = "Camera"; //Camera.main.GetComponent<AudioListener>().enabled = false; StageController.instance.microgameMusicSource.clip = traits.musicClip; if (traits.hideCursor) { Cursor.visible = false; } commandDisplay = StageController.instance.transform.root.Find("UI").Find("Command").GetComponent <CommandDisplay>(); StageController.instance.resetVictory(); StageController.instance.onMicrogameAwake(); } }
private void Awake() { gamecon = GameObject.FindGameObjectWithTag(Tags.gameController) .GetComponent<GameController>(); dman = GetComponent<DialogManager>(); cam = GameObject.FindGameObjectWithTag(Tags.mainCamera).GetComponent<CinematicCamera>(); bgm = GameObject.FindGameObjectWithTag(Tags.gameController) .GetComponent<BGMManager>(); hash = GameObject.FindGameObjectWithTag(Tags.storyController).GetComponent<HashIDs>(); stagecon = GameObject.Find("StageController").GetComponent<StageController>(); alpha = GameObject.Find("Alpha").GetComponent<Actor>(); shadow = GameObject.Find("Shadow").GetComponent<Actor>(); monster = GameObject.Find("Monster"); wave_0 = GameObject.Find("wave_0"); wave_1 = GameObject.Find("wave_1"); wave_2 = GameObject.Find("wave_2"); monster.SetActive(false); wave_0.SetActive(false); wave_1.SetActive(false); wave_2.SetActive(false); dialogs = new List<Dialog>(); //Effect tgt, sound dialogs.Add(new Dialog("Alpha", "Awww......")); dialogs.Add(new Dialog("Alpha", "What happened?", 3)); //Effect tgt, sound dialogs.Add(new Dialog("Shadow", "Don't panic, this is \"the Inner World\".")); dialogs.Add(new Dialog("Alpha", "What's going on now? How come I am here?", 2)); dialogs.Add(new Dialog("Shadow", "Wait, don't you just say that you understand the situation after my explanation.")); dialogs.Add(new Dialog("Alpha", "No way I can understand that. Isn't that just cosplay's dialogue?", 2)); dialogs.Add(new Dialog("Shadow", "Okay. We have just passed through a \"Tunnel\". And we need to defeat \"the Denied\" then we can rescue Beta.")); dialogs.Add(new Dialog("Shadow", "Seem like we got company, lets talk later.")); //monster show up camera motion dialogs.Add(new Dialog("Shadow", "\"The Denied\", our enemy. You should defeat them quickly or else you will get killed.")); dialogs.Add(new Dialog("Alpha", "Enemy!", 3)); dialogs.Add(new Dialog("Shadow", "Don't stand still. Move!", 3)); dialogs.Add(new Dialog("Alpha", "Yes!", 3)); dialogs.Add(new Dialog("System", "Press UP, Down, Left, Right, Jump and Walk to dodge.")); //Battle mode without attack, 5s then paused //battle camera mode //HUD turn on dialogs.Add(new Dialog("Shadow", "You can't beat them if you just keep dodge. Attack!")); dialogs.Add(new Dialog("Alpha", "Even you say so, I don't know how to attack anyway and I got no weapons too!")); dialogs.Add(new Dialog("Shadow", "No, you has the ability to defeat \"the Denied\".")); dialogs.Add(new Dialog("Shadow", "You only need to visualize and conjure the attack, probably.")); dialogs.Add(new Dialog("Alpha", "Probably? Please be serious!", 3)); dialogs.Add(new Dialog("Shadow", "Just try hard to visualize the attack and conjure it!")); dialogs.Add(new Dialog("Alpha", "Visualize...... Visualize...... Attack...... Attack......", 1)); dialogs.Add(new Dialog("System", "Press Attack to shot and Skill to open barrier.")); //Battle mode without attack, 5s then paused //battle camera mode //HUD turn on dialogs.Add(new Dialog("Alpha", "Like that?")); dialogs.Add(new Dialog("Shadow", "Yeah, that's right. Keep going and defeat all of them!", 3)); dialogs.Add(new Dialog("Alpha", "Don't just watch, can you help?")); dialogs.Add(new Dialog("Shadow", "Sorry, I don't have the ability to defeat \"the Denied\". We can only count on you.")); dialogs.Add(new Dialog("Shadow", "Well, they are just minions. You can defeat them with ease, you can do it!")); dialogs.Add(new Dialog("Alpha", "I don't think it's that easy for me...... Sign.")); //Battle mode without attack, 5s then paused //battle camera mode //HUD turn on dialogs.Add(new Dialog("System", "Please defeat all enemies.")); }
// Use this for initialization void Start () { stg_ctrl = GameObject.FindGameObjectWithTag ("GameController").GetComponent<StageController> (); particle = gameObject.GetComponent<ParticleSystem> (); music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> (); }
public void SetStageController(StageController conbtroller) { _stageController = conbtroller; }
private void HandlePlayerDeath() { StageController.StopEnemies(); UIManager.StartCountDown("Ready for next try?!", 3, RepeatStage); }
public void SetNowStageController(StageController stageController) { _nowStageController = stageController; }
private void RepeatStage() { PlayerManager.SpawnPlayer(); StageController.RepeatStage(); }
/// <summary> /// initializies the current upgrade choices. must be called everytime new upgrade choices are presented /// </summary> /// <param name="SkillPool">skill pool of player's current skills, including their current upgrades</param> /// <param name="SlottedSkills">skills that are slotted/equipped by player, skill upgrades can only be chosen from these skills (with the exception of normal attacks)</param> /// <param name="upgrades">amount of upgrades that can be gained</param> public void Init(Dictionary <Skill, TempPlayerSkill> SkillPool, List <Skill> SlottedSkills, int upgrades, StageController control) { GlobalVariables.Instance.HasUI = true; UpgradePool = new List <SkillUpgrade>(); UpgradePoolWithCount = new Dictionary <SkillUpgrade, int>(); // UpgradeOptions = new List<SkillUpgrade>(); //pick skills among the player's skill pool that are equipped UpgradableSkills = new List <TempPlayerSkill>(); UpgradableSkills.Add(SkillPool[Skill.PlayerNormalAttack]); UpgradableSkills.Add(SkillPool[Skill.PlayerNormalRangedAttack]); for (int i = 0; i < SlottedSkills.Count; i++) { if (SlottedSkills[i] != Skill.Default) { UpgradableSkills.Add(SkillPool[SlottedSkills[i]]); } } //add skill upgrades from equipped skill pool that are available to be chosen (fully upgraded skills will not be added) UpgradeOptionPanel = Resources.Load("Prefabs/UI/Overlays/UpgradeOption") as GameObject; stageCtrl = control; //populate upgrade pool from available upgrades for (int i = 0; i < UpgradableSkills.Count; i++) { foreach (KeyValuePair <SkillUpgrade, int> s in UpgradableSkills[i].Upgrades) { if (s.Value < s.Key.MaxUpgrades) { UpgradePool.Add(s.Key); UpgradePoolWithCount.Add(s.Key, s.Value); // Debug.Log(s.Key.Description + "," + s.Value); } } } UpgradesLeftText.text = "Upgrades Remaining: " + upgrades; InitOptions(); }
// Use this for initialization void Start() { Instance = this; SlimePool.Instance.Init(); DamageTextPool.Instance.Init(); SkillAttack1Pool.Instance.Init(); SkillAttack2Pool.Instance.Init (); }
public override void OnTriggerAreaEnter(PlayerController player) { StageController.Restart(); }
// Start is called before the first frame update void Start() { stageController = GameObject.Find("StageController").GetComponent <StageController>(); }
void Start() { stageController = new StageController(); EngineDelegate.instance.SetStageController(stageController); stageController.CreateUnit(0, "Player"); }
public override void OnAttack() { StageController.Restart(); }
private void Start() { stage = FindObjectOfType <StageController>(); InitializeTutorialLanguage(); }
private float fru_total; //合計不満度 void Start() { //ゲーム開始時に不満度を0に fru_img.fillAmount = 0.0f; stagecont = StageController.instance; }
/// <summary> /// StageControllerのセットアップ /// </summary> /// <param name="_stageCon">StageControllerのインスタンス</param> public void SetStageController(StageController _stageCon) { stageCon = _stageCon; VolumeInitialize(); }
void Awake() { instance = this; string sceneName = gameObject.scene.name; if (sceneName.Equals("Template")) { sceneName = "_Template1"; } traits = MicrogameTraits.findMicrogameTraits(sceneName.Substring(0, sceneName.Length - 1), int.Parse(sceneName.Substring(sceneName.Length - 1, 1))); debugMode = GameController.instance == null || GameController.instance.getStartScene() == "Microgame Debug"; if (debugMode) { //Debug Mode Awake (scene open by itself) if (MicrogameDebugObjects.instance == null) { SceneManager.LoadScene("Microgame Debug", LoadSceneMode.Additive); } else { MicrogameDebugObjects.instance.Reset(); } if (preserveDebugSpeed > -1) { Debug.Log("Debugging at speed " + preserveDebugSpeed); debugSettings.speed = preserveDebugSpeed; preserveDebugSpeed = -1; } StageController.beatLength = 60f / 130f; Time.timeScale = StageController.getSpeedMult(debugSettings.speed); victory = traits.defaultVictory; victoryDetermined = false; traits.onAccessInStage(sceneName.Substring(0, sceneName.Length - 1)); } else if (!isBeingDiscarded()) { //Normal Awake StageController.instance.stageCamera.tag = "Camera"; Camera.main.GetComponent <AudioListener>().enabled = false; StageController.instance.microgameMusicSource.clip = traits.musicClip; if (traits.hideCursor) { Cursor.visible = false; } commandDisplay = StageController.instance.transform.root.FindChild("UI").FindChild("Command").GetComponent <CommandDisplay>(); StageController.instance.resetVictory(); StageController.instance.onMicrogameAwake(); } }
/// <summary> /// Update the input for what this net can currently see /// </summary> void RenderVision() { StageController stage = GameMode.main.stage; Vector3 stageCentre = stage.transform.position; float stageSize = stage.currentSize + 0.25f; Vector3 forward = cachedTrans.forward; Vector3 right = cachedTrans.right; // Arena view for (int x = 0; x < ViewResolution; ++x) { for (int y = 0; y < ViewResolution; ++y) { display[x, y] = new NeuralPixel(); // Reset pixel Vector2 dir = new Vector2(x - ViewResolution / 2, y - ViewResolution / 2) * displayScale; Vector3 check = cachedTrans.position + forward * dir.y + right * dir.x; // Calculate if inside of circle float a = check.x - stageCentre.x; float b = check.z - stageCentre.z; if (a * a + b * b <= stageSize * stageSize) { display[x, y].containsStage = true; } } } // Display characters foreach (Character other in GameMode.main.characters) { if (other.IsDead) { continue; } // Draw character Vector2Int pos = WorldToRender(other.transform.position); if (pos.x >= 0 && pos.x < ViewResolution && pos.y >= 0 && pos.y < ViewResolution) { display[pos.x, pos.y].containsCharacter = true; } // Draw arrow if (other.currentProjectile != null) { pos = WorldToRender(other.currentProjectile.transform.position); if (pos.x >= 0 && pos.x < ViewResolution && pos.y >= 0 && pos.y < ViewResolution) { display[pos.x, pos.y].containsArrow = true; } } // Draw sheild if (other.currentShield != null && other.currentShield.IsActive) { pos = WorldToRender(other.currentShield.transform.position); if (pos.x >= 0 && pos.x < ViewResolution && pos.y >= 0 && pos.y < ViewResolution) { display[pos.x, pos.y].containsShield = true; } } } // Update inputs for (int x = 0; x < ViewResolution; ++x) { for (int y = 0; y < ViewResolution; ++y) { int arrowShieldIndex = x + y * ViewResolution; int characterStageIndex = ViewResolution * ViewResolution + x + y * ViewResolution; NeuralPixel pixel = display[x, y]; networkInput[arrowShieldIndex] = pixel.containsArrow ? 1.0f : pixel.containsShield ? -1.0f : 0.0f; networkInput[characterStageIndex] = pixel.containsCharacter ? 1.0f : pixel.containsStage ? -1.0f : 0.0f; } } }
void Start() { if (isBeingDiscarded()) { shutDownMicrogame(); } else { if (debugMode) { //Debug Start MicrogameDebugObjects debugObjects = MicrogameDebugObjects.instance; commandDisplay = debugObjects.commandDisplay; if (debugSettings.localizeText) { LocalizationManager manager = GameController.instance.transform.FindChild("Localization").GetComponent <LocalizationManager>(); if (!string.IsNullOrEmpty(debugSettings.forceLocalizationLanguage)) { manager.setForcedLanguage(debugSettings.forceLocalizationLanguage); } manager.gameObject.SetActive(true); } MicrogameTimer.instance.beatsLeft = (float)traits.getDurationInBeats() + (debugSettings.simulateStartDelay ? 1f : 0f); if (!debugSettings.showTimer) { MicrogameTimer.instance.disableDisplay = true; } if (debugSettings.timerTick) { MicrogameTimer.instance.invokeTick(); } if (debugSettings.playMusic && traits.musicClip != null) { AudioSource source = debugObjects.musicSource; source.clip = traits.musicClip; source.pitch = StageController.getSpeedMult(debugSettings.speed); if (!debugSettings.simulateStartDelay) { source.Play(); } else { AudioHelper.playScheduled(source, StageController.beatLength); } } if (debugSettings.displayCommand) { debugObjects.commandDisplay.play(traits.localizedCommand); } Cursor.visible = traits.controlScheme == MicrogameTraits.ControlScheme.Mouse && !traits.hideCursor; //Cursor.lockState = CursorLockMode.Confined; debugObjects.voicePlayer.loadClips(debugSettings.voiceSet); } SceneManager.SetActiveScene(gameObject.scene); } }
private void LoadStage() { string stageFileName = null; int requestedFactoryID = TileFactory.UNDEFINED_FACTORY_ID; TileFactory modelComponent = null; int modelIndex = -1; Vector2 stageDimensions = Vector2.zero; Vector3 cameraPosition = Vector3.zero; float halfStageHeight = 0f; float newOrthoSize = 0f; StageSettings stageSettings = null; if (stageIndex < 0) { return; } if (stageObject == null) { stageObject = new GameObject("Stage"); stageObject.transform.SetParent(gameObject.transform, false); stageObject.transform.rotation = Quaternion.identity; stageObject.transform.localScale = Vector3.one; stageObject.transform.localPosition = Vector3.zero; stageComponent = stageObject.AddComponent <StageController>(); stageComponent.SetGameController(this); stageComponent.SetItemDatabase(itemDatabase); stageComponent.SetPlayerModel(playerModel); stageComponent.SetEnemyModels(enemyModels); } else { if (stageComponent != null) { stageComponent.Reset(); } } if (tileFactoryComponent != null) { tileFactoryComponent.Clear(); tileFactoryComponent = null; } if (tileFactoryObject != null) { Destroy(tileFactoryObject); tileFactoryObject = null; } /*halmeida - get the file name and the model of the tile factory that the stage wants to use.*/ if (stageSettingComponents != null) { if (stageSettingComponents.Length > stageIndex) { stageSettings = stageSettingComponents[stageIndex]; /*halmeida - since the array is previously verified, the element is surely not null.*/ stageFileName = stageSettings.fileName; requestedFactoryID = stageSettings.tileFactoryID; if (tileFactoryModelComponents != null) { for (int i = 0; i < tileFactoryModelComponents.Length; i++) { modelComponent = tileFactoryModelComponents[i]; if (modelComponent != null) { if (modelComponent.factoryID == requestedFactoryID) { modelIndex = i; break; } } } } } else { /*halmeida - player reached the end of the game.*/ if (stageComponent != null) { stageComponent.Clear(); stageComponent = null; } Destroy(stageObject); stageObject = null; DisplayEnding(); } } if ((stageFileName != null) && (modelIndex > -1)) { tileFactoryObject = Instantiate(tileFactoryModels[modelIndex], Vector3.zero, Quaternion.identity) as GameObject; if (tileFactoryObject != null) { tileFactoryComponent = tileFactoryObject.GetComponent <TileFactory>(); if ((tileFactoryComponent != null) && (stageComponent != null)) { if (inputManager != null) { inputManager.SetStageController(stageComponent); } stageComponent.SetTileFactory(tileFactoryComponent); stageComponent.SetEnemyStateDurations(stageSettings.durationFragileGhost, stageSettings.durationRecoveringGhost); if (stageComponent.LoadFromResourcesFile("Stages/" + stageFileName)) { if (cameraObject != null) { stageDimensions = stageComponent.GetStructureDimensions(); halfStageHeight = stageDimensions.y / 2f; cameraPosition = cameraObject.transform.position; cameraPosition.x = stageDimensions.x / 2f; cameraPosition.y = -halfStageHeight; cameraObject.transform.position = cameraPosition; if (cameraComponent != null) { newOrthoSize = (halfStageHeight > cameraOriginalOrthoSize) ? halfStageHeight : cameraOriginalOrthoSize; cameraComponent.orthographicSize = newOrthoSize; } } } } } } }
protected virtual void OnPlayerGoal() { Destroy(gameObject); StageController.GetStartController().increaseEnemyPoint(1); }
void Awake() { int totalFactories = 0; GameObject tileFactoryModel = null; RectTransform rectTrans = null; GameObject stageSettingObject = null; StageSettings stageSettingComponent = null; lifeImagesPerRow = (lifeImagesPerRow < 1) ? 1 : lifeImagesPerRow; totalLives = (totalLives < 1) ? 1 : totalLives; stageClearAlphaSpeed = (stageClearAlphaSpeed <= 0f) ? 1f : stageClearAlphaSpeed; stageClearTextSpeed = (stageClearTextSpeed <= 0f) ? 1f : stageClearTextSpeed; /*halmeida - I will extract references to every TileFactory component of the models, so that I * can consult them quickly later.*/ tileFactoryModelComponents = null; if (tileFactoryModels != null) { totalFactories = tileFactoryModels.Length; tileFactoryModelComponents = new TileFactory[totalFactories]; for (int i = 0; i < totalFactories; i++) { tileFactoryModel = tileFactoryModels[i]; if (tileFactoryModel != null) { tileFactoryModelComponents[i] = tileFactoryModel.GetComponent <TileFactory>(); } else { tileFactoryModelComponents[i] = null; } } } stageSettingComponents = null; if (stageSettingObjects != null) { for (int i = 0; i < stageSettingObjects.Length; i++) { stageSettingObject = stageSettingObjects[i]; if (stageSettingObject != null) { stageSettingComponent = stageSettingObject.GetComponent <StageSettings>(); if (stageSettingComponent != null) { UsefulFunctions.IncreaseArray <StageSettings>(ref stageSettingComponents, stageSettingComponent); } } } } stageObject = null; stageComponent = null; stageIndex = -1; tileFactoryObject = null; tileFactoryComponent = null; cameraComponent = null; cameraOriginalOrthoSize = 0f; if (cameraObject != null) { cameraComponent = cameraObject.GetComponent <Camera>(); if (cameraComponent != null) { cameraOriginalOrthoSize = cameraComponent.orthographicSize; } } canvasRectTrans = null; if (canvasObject != null) { canvasRectTrans = canvasObject.GetComponent <RectTransform>(); } itemDatabaseObject = null; itemDatabase = null; if (itemDatabaseModel != null) { itemDatabaseObject = Instantiate(itemDatabaseModel, Vector3.zero, Quaternion.identity) as GameObject; itemDatabase = itemDatabaseObject.GetComponent <ItemDatabase>(); if (itemDatabase == null) { Destroy(itemDatabaseObject); itemDatabaseObject = null; } } inputManagerObject = null; inputManager = null; if (inputManagerModel != null) { inputManagerObject = Instantiate(inputManagerModel, Vector3.zero, Quaternion.identity) as GameObject; inputManager = inputManagerObject.GetComponent <InputManager>(); if (inputManager == null) { Destroy(inputManagerObject); inputManagerObject = null; } } scoreTitleObject = null; scoreValueObject = null; scoreValueText = null; totalScore = 0; lifeImageWidth = 0f; lifeImageHeight = 0f; if (lifeImageModel != null) { rectTrans = lifeImageModel.GetComponent <RectTransform>(); if (rectTrans != null) { lifeImageWidth = rectTrans.rect.width; lifeImageHeight = rectTrans.rect.height; } else { lifeImageModel = null; } } lifeImageObjects = null; spareLives = totalLives - 1; endingObject = null; creditsObject = null; stageClearImageObject = null; stageClearImage = null; stageClearTextObject = null; stageClearTextTrans = null; clearTextStartX = 0f; clearTextEndX = 0f; stageCleared = false; stageClearedElapsed = 0f; CreateUIElements(); stageIndex = 0; LoadStage(); }
void Awake() { stageController = this; startTime = Time.time; player = GameObject.FindGameObjectWithTag(TagsAndLayers.player); }