protected virtual void Update() { ApplyOnce.apply("respawn", gameObject, () => { CreateInstance(); return(true); }); }
public void UpdateOnWarp() { if (ApplyOnce.alreadyApplied("Exit", gameObject)) { return; } int beforeTop = warpMenu.topMenu.menuIndex.Get(); int beforeLeft = warpMenu.leftMenu.GetIndex(); warpMenu.Update(); if (beforeTop != warpMenu.topMenu.menuIndex.Get()) { UpdateShrines(); } if (beforeLeft != warpMenu.leftMenu.GetIndex()) { if (currentImg) { currentImg.sprite = warpMenu.leftMenu.list[warpMenu.leftMenu.GetIndex()].shrineSprite; } } if (ButtonManager.GetDown(ButtonManager.ButtonID.CIRCLE, this)) { ApplyOnce.apply("Exit", gameObject, () => { if (currentImg) { currentImg.sprite = null; } uiManager.ChangeMode(UIManager.Mode.NORMAL); uiManager.GetPlayer().ReceiveNotification(Asderek.Notification.Return); return(true); }); } if (ButtonManager.GetDown(ButtonManager.ButtonID.X, this)) { //if (currentImg) // currentImg.sprite = null; ApplyOnce.apply("Exit", gameObject, () => { foreach (KeyValuePair <Commandments.Shrines, ShrineInfo> element in shrineToTexture) { if (element.Value.Equals(warpMenu.leftMenu.list[warpMenu.leftMenu.GetIndex()])) { loadManager.loadShrine(element.Key); UIManager.GetInstance().ChangeMode(UIManager.Mode.NORMAL); break; } } return(true); } ); } }
protected virtual void OnDisable() { if (spawnee != null) { spawnee.Tick -= new Spawnee.TickHandler(RespawnAfter); Destroy(spawnee.gameObject); } ApplyOnce.remove("respawn", gameObject); }
public void Reload() { ApplyOnce.apply("Reload", gameObject, () => { manager.ChangeHP(1); loadShrine(destinyShrine); return(true); }); }
public void Update() { if (ApplyOnce.alreadyApplied("Interact", gameObject)) { if (player.FinishedAnimation("sitting_neutral") || player.FinishedAnimation("seated")) { manager.SetWarp(displayImg); ApplyOnce.remove("Interact", gameObject); } } }
public void verifyLoad() { if (startLoading) { if (playerScript.FinishedAnimation("sitting_neutral") || playerScript.FinishedAnimation("seated") || ApplyOnce.alreadyApplied("Reload", gameObject)) { gameLoaded = false; //Interaction manager.ClearScreen(); //string path = Application.dataPath + "/"; string path = "D:/"; string name = "temp.png"; ApplyOnce.apply("ScreenShot", gameObject, () => { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } File.Delete(path + name); ScreenCapture.CaptureScreenshot(path + name); UpdateLoadPoints(); if (!ApplyOnce.alreadyApplied("Reload", gameObject)) { Time.timeScale = 0; } return(true); }); if (File.Exists(path + name)) { if (ApplyOnce.alreadyApplied("Reload", gameObject)) { playerScript.ReceiveNotification(Asderek.Notification.Sit); } Texture2D auxImage = new Texture2D(100, 100); auxImage.LoadImage(File.ReadAllBytes(path + name)); File.Delete(path + name); colors = auxImage.GetPixels(); warpImage = new Texture2D(auxImage.width, auxImage.height); warpImage.SetPixels(colors); warpImage.Apply(); startLoading = false; loadShrine(); } } } }
public override void ActivateInteraction() { base.ActivateInteraction(); player.GetComponent <Asderek>().LerpToPosition(transform.position); ApplyOnce.apply("Interact", gameObject, () => { return(true); }); /* * if (id == Commandments.Shrines.FIRE_STAGE_1) * load.loadShrine(Commandments.Shrines.FIRE_STAGE_2); * else if (id== Commandments.Shrines.FIRE_STAGE_2) * load.loadShrine(Commandments.Shrines.NEXUS); * else if (id == Commandments.Shrines.NEXUS) * load.loadShrine(Commandments.Shrines.FIRE_STAGE_1); */ }
void Update() { verifyLoad(); if (startTime < transitionTime) { if (ApplyOnce.alreadyApplied("Reload", gameObject)) { UpdateCircleConstricting(); UpdateHalo(); startTime--; if (startTime < 0) { startTime = 0; ApplyOnce.remove("Reload", gameObject); } ApplyOnce.apply("ChangeMode", gameObject, () => { UIManager.GetInstance().ChangeMode(UIManager.Mode.NORMAL); return(true); }); } else { if (startTime == 0) { UpdateLoadPoints(); } UpdateCircleSimplified(); startTime++; UpdateHalo(); } if (startTime >= transitionTime) { ApplyOnce.apply("notifyAsderek", gameObject, () => { playerScript.ReceiveNotification(Asderek.Notification.Return); warpImage = null; Time.timeScale = manager.chosenTime; gameLoaded = true; ApplyOnce.remove("ChangeMode", gameObject); return(true); }); } } }
void Update() { ApplyOnce.apply("StartGame", gameObject, () => { uiManager = UIManager.GetInstance(); UpdateLanguage(); return(true); }); //if(Input.GetButtonUp("SELECT")) //{ // if (saveIndex >= 0) { // saveJson.saves[saveIndex].saveGame(); // saveJson.config.lastSave = saveIndex; // saveJson.Save("save.json"); // } //} }
protected override string OnLedge() { if (isOnRange(viewRange)) //se o player está na distancia de chasing { //print("OnRange<br>"); return(null); } //print("NotOnRange"); ApplyOnce.apply(ao_turnSentry, gameObject, () => { //print((("Apply f*****g Once " + gameObject))); TurnCharacter((Direction)(-getDirection())); AchieveMaxSpeed(maxSpeed); return(true); }); return("activateRunning"); }
private void OnGUI() { if (startTime < transitionTime) { if (warpImage) { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), warpImage); if (haloText != null && !ApplyOnce.alreadyApplied("Reload", gameObject)) { GUI.DrawTexture(haloRect, haloText); } else if (haloConstrictingText != null && ApplyOnce.alreadyApplied("Reload", gameObject)) { GUI.DrawTexture(haloRect, haloConstrictingText); } } } }
public bool Update() { bool ret = false; if ((currentState == State.Pressed) && (lastDown >= longClick / 2)) { currentState = State.Hold; } if (Get()) { ApplyOnce.apply("pressed", this, () => { lastDown = 0; currentState = State.Pressed; ret = true; return(true); }); } else { if (ApplyOnce.alreadyApplied("pressed", this)) { if (lastDown >= longClick) { currentState = State.Long; } else { currentState = State.Short; } ApplyOnce.remove("pressed", this); } else { currentState = State.None; requester = null; } } lastDown++; return(ret); }
private void SetActors() { foreach (KeyValuePair <Commandments.Shrines, GameObject> element in onScene) { //Debug.Log("Clearing shrine " + element.Key); Shrine shrine = element.Value.GetComponent <Shrine>(); if (shrine) { shrine.Clear(); } } Vector3 tempVect = onScene[destinyShrine].transform.position; tempVect.z = player.transform.position.z; player.transform.position = tempVect; playerScript.ResetLerp(); playerScript.Reload(); gameManager.getCurrentCamera().InstantChangeLocation(player); //msg = "New Player position: " + player.transform.position; if (warpImage) { if (ApplyOnce.alreadyApplied("Reload", gameObject)) { startTime = transitionTime - 1; } else { //startTime = 0; //startTime = DEBUG_asd; for (startTime = 0; startTime < 2; startTime++) { UpdateCircleSimplified(); } } } ApplyOnce.remove("notifyAsderek", gameObject); ApplyOnce.remove("ScreenShot", gameObject); }
void OnTriggerEnter2D(Collider2D colisor) { if (colisor.gameObject.GetComponent <Sonar>() != null) { ApplyOnce.apply(applyString, gameObject, () => { LineDrawer.startColor = colisor.gameObject.GetComponent <LineRenderer>().startColor; LineDrawer.endColor = colisor.gameObject.GetComponent <LineRenderer>().endColor; Vector2 aux = colisor.transform.position - transform.position; echoDirection = Mathf.Rad2Deg * Mathf.Atan2(aux.y, aux.x); receivePing = true; GetComponent <CircleCollider2D>().enabled = false; LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth / 7; Instantiate(gameObject, transform.position, Quaternion.identity); LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth * 7; radius = 2 * radiusFactor; LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth / 2; Instantiate(gameObject, transform.position, Quaternion.identity); LineDrawer.startWidth = LineDrawer.endWidth = LineDrawer.startWidth * 2; radius = 4 * radiusFactor; parent = true; return(true); }); } }
protected virtual string Running() { float direction; string nextState; if (isOnWall) { ApplyOnce.apply(ao_turnSentry, gameObject, () => { TurnCharacter((Direction)(-getDirection())); AchieveMaxSpeed(maxSpeed); return(true); }); AchieveMaxSpeed(maxSpeed); return("activateRunning"); } if (!isOnGround) { nextState = LeaveGround(); if (nextState != null) { return(nextState); } } if (isOnLedge) { nextState = OnLedge(); if (nextState != null) { return(nextState); } } ApplyOnce.remove(ao_turnSentry, gameObject); string ret = DecideAttack(); if (ret != null) { return(ret); } if (isOnRange(viewRange)) //se o player está na distancia de chasing { nextState = BeginChase(); if (nextState != null) { return(nextState); } } float CurrentDistance = transform.position.x - initialPosition; direction = (((int)transform.eulerAngles.y) / -90) + 1; /*+1 right -1 left*/ nextState = "activateRunning"; if (direction * CurrentDistance > (scoutRange + AUXRANGE)) { transform.eulerAngles = new Vector2(0, (direction + 1) * 90); } else if (direction * CurrentDistance > (scoutRange)) { transform.eulerAngles = new Vector2(0, (direction + 1) * 90); if (direction > 0) { nextState = "activateSitting"; } else { nextState = "activateChilling"; } } AchieveMaxSpeed(maxSpeed); return(nextState); }
public void ChangeLanguage(string name, bool force = false) { if ((languagues[currentLanguage.Get()].name == name) && (!force)) { return; } for (int i = 0; i < languagues.Length; i++) { if (languagues[i].name == name) { currentLanguage.Set(i); yokaiDescriptionsJson.Load(languagues[i].yokaiJson); Beastiary beastiary = GetComponentInChildren <Beastiary>(); foreach (YokaisJson.Description desc in yokaiDescriptionsJson.description) { beastiary.yokais[desc.id].name = desc.name; beastiary.yokais[desc.id].description = desc.formatedText; } npcsJson.Load(languagues[i].npcJson); abilitiesJson.Load(languagues[i].abilityJson); menuJson.Load(languagues[i].menuJson); //print("Update menuJson Json Description: " + languagues[i].menuJson.name); //print("abilitiesJson: " + menuJson.mainMenu[0].name); for (int j = 0; j < menuJson.optionsMenu.Length; j++) { for (int k = 0; k < menuJson.optionsMenu[j].items.Length; k++) { switch (menuJson.optionsMenu[j].items[k].type) { case MenuJson.OptionMenuTab.OptionsMenuItem.Type.Combo: menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(menuJson.optionsMenu[j].items[k].combo.Length); break; case MenuJson.OptionMenuTab.OptionsMenuItem.Type.Special: switch (menuJson.optionsMenu[j].items[k].special) { case MenuJson.OptionMenuTab.OptionsMenuItem.SpecialType.Language: menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(languagues.Length); break; case MenuJson.OptionMenuTab.OptionsMenuItem.SpecialType.TitleFont: menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(fonts.Length); menuJson.optionsMenu[j].items[k].comboSelected.Set(saveJson.config.titleFontIndex); break; case MenuJson.OptionMenuTab.OptionsMenuItem.SpecialType.TextFont: menuJson.optionsMenu[j].items[k].comboSelected = new CircularIndex(fonts.Length); menuJson.optionsMenu[j].items[k].comboSelected.Set(saveJson.config.textFontIndex); break; } break; } } } if (ApplyOnce.alreadyApplied("StartGame", gameObject)) { UpdateLanguage(); } break; } } }
// Update is called once per frame void Update() { if (!receivePing) { return; } size = (int)((1f / ThetaScale) + 1f); float startAngle = (echoDirection - echoAngle / 2f) % 360; float endAngle = (echoDirection + echoAngle / 2f) % 360; startAngle += (startAngle < 0) ? 360 : 0; endAngle += (startAngle < 0) ? 360 : 0; int startIndex = (int)((startAngle / 360f) * size); int finalIndex = (int)((endAngle / 360f) * size); if (finalIndex > startIndex) { size = finalIndex - startIndex + 1; } else { size = size - startIndex + finalIndex; } LineDrawer.positionCount = size; Theta = startIndex * (2.0f * Mathf.PI * ThetaScale); for (int i = 0; i < size; i++) { Theta += (2.0f * Mathf.PI * ThetaScale); float x = radius * Mathf.Cos(Theta) + transform.position.x; float y = radius * Mathf.Sin(Theta) + transform.position.y; LineDrawer.SetPosition(i, new Vector3(x, y, 0)); } if (radius > maxRadiusSize) { if (parent) { radius = startRadius; receivePing = false; parent = false; GetComponent <CircleCollider2D>().enabled = true; LineDrawer.positionCount = 0; GameObject son = Instantiate(gameObject, transform.position, Quaternion.identity); son.transform.localScale = transform.lossyScale; son.transform.parent = transform.parent; } ApplyOnce.remove(applyString, gameObject); Destroy(gameObject); } else { radius += radiusFactor; } }
public void SetShrineImage(SpriteRenderer displayImg) { ApplyOnce.remove("Exit", gameObject); currentImg = displayImg; UpdateScenes(); }