private void OnRequestChangeCamLimits(IGameEvent obj) { StandardSendGameEvent ssge = (StandardSendGameEvent)obj; lerpLimitantes = CalcularLimitantes((DadosDeCena.LimitantesDaCena)ssge.MyObject[0]); Vector3 pos = transform.position; if (!useLimitsCam) { limitantes = new DadosDeCena.LimitantesDaCena() { xMax = (pos.x + wordWidthOfScreen), xMin = (pos.x - wordWidthOfScreen), yMin = (pos.y - wordheightOfScreen), yMax = (pos.y + wordheightOfScreen) } } ; tempoDeLerpLimits = (float)ssge.MyObject[1]; lerpLimitantesTransitorio = (DadosDeCena.LimitantesDaCena)limitantes.Clone(); tempoDecorrido = 0; useLimitsCam = true; pedindoLimiteLerp = true; }
void SetarLimitantesTransitorio() { DadosDeCena c = GlobalController.g.SceneDates.GetCurrentSceneDates(); if (c != null) { GetComponent <Camera>().backgroundColor = c.bkColor; } /* * DadosDeCena.LimitantesDaCena dl = c.limitantes; * Debug.Log(dl.xMin+" : "+dl.xMax+" : "+dl.yMin+" : "+dl.yMax); */ lerpLimitantes = c != null?CalcularLimitantes(c.limitantes) : null; if (lerpLimitantes != null) { useLimitsCam = true; } else { useLimitsCam = false; } }
DadosDeCena.LimitantesDaCena CalcularLimitantes(DadosDeCena.LimitantesDaCena c) { return(new DadosDeCena.LimitantesDaCena() { xMin = (c.xMax - c.xMin) > 2 * (int)wordWidthOfScreen? c.xMin + (int)wordWidthOfScreen:ValorDeAjuste(c.xMin, c.xMax) - 1, xMax = (c.xMax - c.xMin) > 2 * (int)wordWidthOfScreen ? c.xMax - (int)wordWidthOfScreen: ValorDeAjuste(c.xMin, c.xMax) + 1, yMin = (c.yMax - c.yMin) > 2 * (int)wordheightOfScreen? c.yMin + (int)wordheightOfScreen:ValorDeAjuste(c.yMin, c.yMax) - 1, yMax = (c.yMax - c.yMin) > 2 * (int)wordheightOfScreen ? c.yMax - (int)wordheightOfScreen: ValorDeAjuste(c.yMin, c.yMax) + 1 }); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (usarLimitanteDaCena != NomesCenas.nula) { limitantes = GlobalController.g.SceneDates.GetCurrentSceneDates().limitantes; } EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeCamLimits, limitantes, tempoDeLerpLimits)); } }
private void OnLimitCamOk(IGameEvent obj) { StandardSendGameEvent ssge = (StandardSendGameEvent)obj; DadosDeCena.LimitantesDaCena l = (DadosDeCena.LimitantesDaCena)ssge.MyObject[0]; if (limitantes.CompareTo(l) <= Screen.width + Screen.height) { limitanteOk = true; VerificaIniciaQuedaDoBoss(); } }
private void OnRequestStandardLimits(IGameEvent e) { SetarLimitantesTransitorio(); if (lerpLimitantes != null) { tempoDecorrido = 0; pedindoLimiteLerp = true; } else { limitantes = lerpLimitantesTransitorio; } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { if (UnicidadeDoPlayer.Verifique(collision)) { if (cenaDosLimitantes != NomesCenas.nula) { limitantes = GlobalController.g.SceneDates.GetSceneDates(cenaDosLimitantes).limitantes; } SceneManager.activeSceneChanged += ModifiqueLimitantesAct; SceneManager.sceneLoaded += ModifiqueLimitantes; } } }
private void OnRequestFillDates(IGameEvent e) { StandardSendGameEvent ssge = (StandardSendGameEvent)e; SaveDates S = (SaveDates)ssge.MyObject[0]; if (S == null) { transform.position = new Vector3(-8, -2, -10); } else { transform.position = S.Posicao + new Vector3(0, 0, -10); } SetarLimitantesTransitorio(); limitantes = lerpLimitantes; }
public void VerifiqueLimitantesParaMudeCena(NomesCenas cenaAlvo) { if (camLimits != null) { if (camLimits.Length > 0) { limitantes = (DadosDeCena.LimitantesDaCena)GlobalController.g.SceneDates.GetSceneDates(cenaAlvo).limitantes.Clone(); for (int i = 0; i < camLimits.Length; i++) { AltereLimitante(camLimits[i]); } SceneManager.activeSceneChanged += ModifiqueLimitantesAct; SceneManager.sceneLoaded += ModifiqueLimitantes; } } }
public void MudeLimitantesParaTrigger(NomesCenas cenaAlvo, float tempoDeLerpLimits) { limitantes = (DadosDeCena.LimitantesDaCena)GlobalController.g.SceneDates.GetSceneDates(cenaAlvo).limitantes.Clone(); if (camLimits != null) { if (camLimits.Length > 0) { //Debug.Log("send event A" + limitantes.xMax + " : " + tempoDeLerpLimits); for (int i = 0; i < camLimits.Length; i++) { AltereLimitante(camLimits[i]); } } } EventAgregator.Publish(new StandardSendGameEvent(EventKey.requestChangeCamLimits, limitantes, tempoDeLerpLimits)); }
public static DadosDeCena.LimitantesDaCena SetarLimits() { DadosDeCena.LimitantesDaCena limitantes = new DadosDeCena.LimitantesDaCena(); GameObject G = GameObject.Find("startBlock"); if (G != null) { limitantes.xMin = G.transform.position.x; limitantes.yMin = G.transform.position.y; } G = GameObject.Find("endBlock"); if (G != null) { limitantes.xMax = G.transform.position.x; limitantes.yMax = G.transform.position.y; } return(limitantes); }
// Use this for initialization void Start() { Transform T = Instantiate(paralaxContainer).transform; T.parent = transform; T.localPosition = T.localPosition = new Vector3(1, paralaxContainer.transform.localPosition.y, 0); T.localScale = paralaxContainer.transform.localScale; T = Instantiate(paralaxContainer).transform; T.parent = transform; T.localPosition = T.localPosition = new Vector3(-1, paralaxContainer.transform.localPosition.y, 0); T.localScale = paralaxContainer.transform.localScale; startPosition = transform.position.x; length = GetComponent <SpriteRenderer>().bounds.size.x; cameraPlayer = FindObjectOfType <Camera2D>().transform; eParalax = transform.Find("eParalax"); sParalax = transform.Find("sParalax"); l = Paralax.SetarLimits(); Debug.Log(length); }
public void AposMudarDeCena(Vector3 pos) { transform.position = pos; SetarLimitantesTransitorio(); limitantes = lerpLimitantes; }
// Use this for initialization void Start() { limitantes = SetarLimits(); SetarParalaxLimits(); camera = FindObjectOfType <Camera2D>().transform; }