void OnTriggerStay2D(Collider2D other) { if (Input.GetKey("e") && !ismoving) { ismoving = true; float speedtemp = GamePersist.GetInstance().hero.speed; GamePersist.GetInstance().hero.speed = 0; Vector3 startposition = GamePersist.GetInstance().hero.sceneRect.position; Vector3 endposition = new Vector3 (GamePersist.GetInstance().hero.sceneRect.position.x, GamePersist.GetInstance().hero.sceneRect.position.y + (GameObject.Find(departure).transform.position.y - GameObject.Find(destination).transform.position.y), GamePersist.GetInstance().hero.sceneRect.position.z); if (this.transform.position.x - GameObject.Find(destination).transform.position.x > 0) { endposition.x += 10; } else { endposition.x -= 10; } StartCoroutine(Delay.DelayToInvokeDo(() => { GamePersist.GetInstance().hero.sceneRect.position = endposition; //GamePersist.GetInstance().hero.isVisible = true; GamePersist.GetInstance().hero.speed = speedtemp; ismoving = false; }, 0.5f)); temp = departure; departure = destination; destination = temp; } }
void OnTriggerEnter2D(Collider2D other) { //if (Input.GetKey("e")) //{ GamePersist.GetInstance().subtitle = "你怎么会来这里,他们杀人不眨眼,你快逃吧,只有唯一一条路可以出去,我只知道在山上。"; StartCoroutine(Delay.DelayToInvokeDo(() => { GamePersist.GetInstance().subtitle = "拿着这个信物,找到 XXX,他会带你离开。"; }, 1f)); //} }
void OnTriggerEnter2D(Collider2D other) { GamePersist.GetInstance().subtitle = "啊,你手里有 XX(伙夫赠送的道具),我相信你。"; StartCoroutine(Delay.DelayToInvokeDo(() => { GamePersist.GetInstance().subtitle = "我们从这里出去,到金城关前出关,我这里有文牒。"; }, 1f)); StartCoroutine(Delay.DelayToInvokeDo(() => { GamePersist.GetInstance().subtitle = "你通关了"; }, 3f)); }
void OnTriggerEnter2D(Collider2D other) { this.spirte.sortingOrder = 10; //GamePersist.GetInstance().subtitle = "啊,官逼民反啊。"; StartCoroutine(Delay.DelayToInvokeDo(() => { if (!GamePersist.GetInstance().hero.isHide) { GamePersist.GetInstance().hero.heroMove = false; //GamePersist.GetInstance().subtitle = "你死了"; StartCoroutine(EndGame()); } }, 1.5f)); }
void OnTriggerStay2D(Collider2D other) { if (!GamePersist.GetInstance().hero.isHide&& Input.GetKey("e")) { GamePersist.GetInstance().hero.isHide = true; GamePersist.GetInstance().hero.speed = 0; GamePersist.GetInstance().subtitle = "你藏起来了"; GamePersist.GetInstance().hero.heroRect.Translate(new Vector3(0, 0, 3)); } StartCoroutine(Delay.DelayToInvokeDo(() => { if (GamePersist.GetInstance().hero.isHide&& Input.GetKey("e")) { GamePersist.GetInstance().hero.isHide = false; GamePersist.GetInstance().hero.speed = 3; GamePersist.GetInstance().subtitle = "你出来了"; GamePersist.GetInstance().hero.heroRect.Translate(new Vector3(0, 0, -3)); } }, 0.5f)); }
void OnTriggerStay2D(Collider2D other) { if (Input.GetKey("e") && !ismoving) { ismoving = true; float temp = GamePersist.GetInstance().hero.speed; GamePersist.GetInstance().hero.speed = 0; GamePersist.GetInstance().hero.MakeInvisible(); StartCoroutine(Delay.DelayToInvokeDo(() => { GamePersist.GetInstance().hero.sceneRect.position = new Vector3( (GamePersist.GetInstance().hero.sceneRect.position.x + (this.transform.position.x - GameObject.Find(destination).transform.position.x)), GamePersist.GetInstance().hero.sceneRect.position.y + (this.transform.position.y - GameObject.Find(destination).transform.position.y), GamePersist.GetInstance().hero.sceneRect.position.z); //GamePersist.GetInstance().hero.isVisible = true; GamePersist.GetInstance().hero.speed = temp; ismoving = false; }, 1.5f)); } }