public override void HandleEvent(EventData resp) { if (InGameManager.GetInstance().gameState != enGameState.playing) { return; } if (bullet == null) { return; } switch (resp.eid) { case EventID.EVENT_TOUCH_DOWN: EventTouch eve = (EventTouch)resp; //TouchToPlane(eve.pos); //Fire(GameCommon.ScreenPositionToWorld(eve.pos)); Vector3 pos = GameCommon.ScreenPositionToWorld(InGameManager.GetInstance().gamecamera, eve.pos); if (pos.y > InGameManager.GetInstance().inGameUIManager.gamePadManager.comboLabelPos.y - 1) { return; } bullet.Fire(); AudioManager.Instance.Play("sound/btn"); bullet = null; break; } }
public void AddBulletUpdate() { if (bullet != null) { return; } addBulletTime += Time.deltaTime; if (addBulletTime < addBulletMaxTime) { return; } addBulletTime = 0f; GameObject bulletObj = Resources.Load("Prefabs/MapObj/InGameBullet") as GameObject; bulletObj = Instantiate(bulletObj); InGameBullet b = bulletObj.GetComponent <InGameBullet>(); bullet = b; b.transform.position = transform.position; b.transform.localScale = new Vector3(0.5f, 0.5f, 1f); InGameManager.GetInstance().inGameLevelManager.AddObj(b); }