// Update is called once per frame void Update() { if (m_sceneMain.IsGamePlay() == false) { return; } Vector3 vector = SceneMain.GetInput(m_initData.playerNo); rigidbody.velocity = vector * m_speed; // 歩行音を鳴らす if (rigidbody.velocity.sqrMagnitude > 0F) { walkSEObj.enabled = true; } else { walkSEObj.enabled = false; } // 移動した方向を向く if (rigidbody.velocity.magnitude > 0.01f) //ベクトルの長さが0.01fより大きい場合にプレイヤーの向きを変える処理を入れる(0では入れないので) { detective.transform.rotation = Quaternion.LookRotation(rigidbody.velocity); //ベクトルの情報をQuaternion.LookRotationに引き渡し回転量を取得しプレイヤーを回転させる } }
public TopMenu(IAudioEngine s, Player p, SceneMain m, SaveData save) : base(s) { this.savedata = save; this.main = m; this.player = p; this.Init(); }
public override void OnShow() { slider.interactable = false; //禁用交互 SceneMain sceneMain = SceneManager.Instance.CreateScene <SceneMain>(); sceneMain.SetLoadingProgress(setLoadingProgress); SceneManager.Instance.PushScene(sceneMain); }
public FolderSelect(IAudioEngine s, Player p, SceneMain m, TopMenu t, SaveData save) : base(s, p, t, save) { this.main = m; this.main.FolderReset(); this.nowscene = FolderSelect.SCENE.fadein; this.subMenu = new FolderEdit(this.sound, p, m, t, this, save); this.Alpha = byte.MaxValue; this.FolderCheckAll(); }
void Start() { #if UNITY_EDITOR Exited = false; #endif GameObject.DontDestroyOnLoad(this); Instance = this; GlobalInit(); m_FrameTick = m_GCTick = Utility.GetTickCount(); }
public Navi(IAudioEngine s, Player p, SceneMain m, TopMenu t, SaveData save) : base(s, p, t, save) { this.eventmanager = new EventManager(this.sound); this.Alpha = byte.MaxValue; this.pageX[0] = 112; this.pageX[1] = 240; this.main = m; this.manager = new AddOnManager(s, p, t, this, this.savedata); }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { _instance = this; } }
// Start is called before the first frame update void Start() { detective = transform.Find("detective/detective").gameObject; rigidbody = GetComponent <Rigidbody>(); m_textMeshObj = transform.Find("TextMesh").gameObject; m_textMeshObj.GetComponent <TextMesh>().text = string.Format("{0}P", m_initData.playerNo + 1); // 当たり判定関数を登録 var hit = transform.Find("Hit").gameObject.GetComponent <HitClass>().hitCallback = Hit; m_audio = this.GetComponent <AudioSource>(); m_sceneMain = GameObject.Find("SceneMain").GetComponent <SceneMain>(); }
public Save(IAudioEngine s, Player p, TopMenu t, SaveData save, SceneMain m) : base(s, p, t, save) { this.main = m; this.yesno = true; this.Alpha = byte.MaxValue; this.time = this.savedata.GetTime(); this.comp = this.savedata.GetHaveManyChips(); this.chips = this.savedata.GetHaveChips(); this.money = this.savedata.Money.ToString(); this.thread_1 = new Thread(new ThreadStart(() => this.savedata.SaveFile(this.main.parent))); }
public SceneBattle( IAudioEngine s, ShanghaiEXE p, SceneMain main, EventManager e, bool res, int count, bool gameover, string bgm, SaveData save) : base(s, p, save) { p.TexClear(false); this.main = main; this.gameover = gameover; this.bgm = bgm; this.doresult = res; for (int x = 0; x < this.panel.GetLength(0); ++x) { for (int y = 0; y < this.panel.GetLength(1); ++y) { this.panel[x, y] = new Panel(this.sound, this, x, y) { state = Panel.PANEL._nomal, color = x >= 3 ? Panel.COLOR.blue : Panel.COLOR.red }; this.panel[x, y].colordefault = this.panel[x, y].color; if (x == 0 || x == 5) { this.panel[x, y].inviolability = true; } } } this.battlenum = this.savedata.ValList[9]; this.tutorial = this.parent.tutorial; this.eventmanager = e; this.playerstatus = main; this.positionHPwindow = new Vector2(24f, 8f); this.mind = new MindWindow(this.sound, this, this.savedata); this.player = new Player(this.sound, this, 1, 1, main, this.savedata.busterspec[0], this.savedata.busterspec[1], this.savedata.busterspec[2], this.mind, this.savedata); this.players.Add(this.player); this.parent = p; this.back = new BackDefault(); this.nowscene = SceneBattle.BATTLESCENE.init; this.custom = new Custom(this.sound, this, main, this.player, this.savedata); this.customgauge = new CustomGauge(this.sound); this.battlecount = count; AttackBase.AtIDBlue = 0L; AttackBase.AtIDRed = 0L; }
public static SceneMain instance = null; //Static instance of GameManager which allows it to be accessed by any other script. void Awake() { //Check if instance already exists if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } //Sets this to not be destroyed when reloading scene // use full to keep it until the end of the game. }
public ShanghaiBase( IAudioEngine s, SceneBattle p, int pX, int pY, SceneMain main, byte bp, byte br, byte bc, MindWindow m, SaveData save) : base(s, p, pX, pY, main, bp, br, bc, m, save) { this.union = Panel.COLOR.blue; this.rebirth = true; this.number = -2; }
// Start is called before the first frame update void Start() { phantom = transform.Find("phantom/phantom").gameObject; m_renderer = phantom.GetComponent <Renderer>(); m_rigidbody = GetComponent <Rigidbody>(); m_animator = phantom.GetComponent <Animator>(); m_textMeshObj = transform.Find("TextMesh").gameObject; m_textMeshObj.GetComponent <TextMesh>().text = string.Format("{0}P", m_initData.playerNo + 1); m_audio = this.GetComponent <AudioSource>(); m_scoreParent = GameObject.Find(string.Format("Score{0}", m_phantomNo)); m_sceneMain = GameObject.Find("SceneMain").GetComponent <SceneMain>(); // 当たり判定関数を登録 var hit = transform.Find("Hit").gameObject.GetComponent <HitClass>().hitCallback = Hit; UpdateScoreUi(); }
public Player( IAudioEngine s, SceneMap p, Point po, int floor, MapCharacterBase.ANGLE a, SceneMain m, SaveData save, float Z) : base(s, p, po, floor, a, null) { this.position.Z = Z; this.main = m; this.menu = new TopMenu(s, this, this.main, save); this.rendType = 1; this.savedata = save; this.player = true; this.info = new InfoMessage(this.sound, this.savedata); }
/// <summary> /// 移動処理 /// </summary> private void Move() { Vector3 vector = SceneMain.GetInput(m_initData.playerNo); Vector3 pos = transform.position; eAnimState animState = eAnimState.Stop; if (vector.magnitude > m_runThreshold) { animState = eAnimState.Run; } else if (vector.magnitude < 0.1f) { animState = eAnimState.Stop; } else { animState = eAnimState.Walk; } m_rigidbody.velocity = vector * m_speed; // 移動した方向を向く if (m_rigidbody.velocity.magnitude > 0.01f) //ベクトルの長さが0.01fより大きい場合にプレイヤーの向きを変える処理を入れる(0では入れないので) { phantom.transform.rotation = Quaternion.LookRotation(m_rigidbody.velocity); //ベクトルの情報をQuaternion.LookRotationに引き渡し回転量を取得しプレイヤーを回転させる } // アニメーション更新 if (m_animState != animState) { switch (animState) { case eAnimState.Stop: m_animator.SetTrigger("idle"); break; case eAnimState.Walk: m_animator.SetTrigger("walk"); break; case eAnimState.Run: m_animator.SetTrigger("run"); // エフェクト if (m_runEffect == null) { m_runEffect = Instantiate(Resources.Load("Prefabs/Effect/NoiseParticel")) as GameObject; m_runEffect.transform.parent = transform; m_runEffect.transform.localPosition = Vector3.zero; var particle = m_runEffect.GetComponent <ParticleSystem>(); var color = particle.colorOverLifetime; switch (m_phantomNo) { case 0: color.color = Color.red; break; case 1: color.color = Color.blue; break; case 2: color.color = Color.green; break; } } break; } m_animState = animState; } // 透過処理 { Color color; // 騒音状態更新 if (m_animState == eAnimState.Run) { m_appearTime = AppearTime; } if (m_appearTime > 0.0f) // 騒音状態 { m_appearTime -= Time.deltaTime; if (m_appearTime <= 0.0f) { if (m_runEffect != null) { GameObject.Destroy(m_runEffect); m_runEffect = null; } } m_renderer.material = m_normalMat; color = m_renderer.material.color; color.a = 1.0f; m_renderer.material.color = color; m_textMeshObj.SetActive(true); } else if (vector.magnitude < m_visibleThreshold) // 完全透過状態 { m_renderer.material = m_fadeMat; color = m_renderer.material.color; color.a = 0.0f; m_renderer.material.color = color; m_textMeshObj.SetActive(false); } else // 歩き { m_renderer.material = m_fadeMat; color = m_renderer.material.color; color.a = Mathf.Lerp(0.0f, 1.0f, (vector.magnitude - m_visibleThreshold) / (m_runThreshold - m_visibleThreshold)); m_renderer.material.color = color; m_textMeshObj.SetActive(false); } } }
public void go(int buildIndex) { SceneMain.ChangeTo(buildIndex); }
public void gotoo(string sceneName) { SceneMain.ChangeTo(sceneName); }
private void Awake() { instance = GetComponent <PauseManager>(); panelOpen = false; glossy = glossaryObj.GetComponent <Glossary>(); SceneMain scene = glossy.GetScene(BaseSaver.getMap()); GameObject.Find("MenuTitle").SetActive(true); GameObject.Find("MenuTitle").GetComponent <Text>().text = scene.meta.name; StartCoroutine(WaitForAction(3f)); GameObject map = Instantiate(scene.map, new Vector3(0, 0, 0), Quaternion.identity); map.SetActive(true); swapping = false; deleting = false; Debug.Log("PauseManager Awake"); AdventureMeta meta = BaseSaver.getAdventure(); BoardMeta board = BaseSaver.getBoard(BaseSaver.getMap()); GameObject hero = GameObject.FindWithTag("Player"); if (BaseSaver.getMap().Equals("ShallowGrove") && BaseSaver.getMapPrev() != "") { hero.SetActive(false); hero = null; Destroy(GameObject.FindWithTag("Player")); } if (hero == null) { // Pull the hero out of the glossary and instantiate it in the right exit/entrance tile GameObject nHero = null; string dest = BaseSaver.getMapConnection(); string prev = BaseSaver.getMapPrev(); Debug.Log("Prev: " + prev); Debug.Log("Dest: " + dest); foreach (GameObject exit in GameObject.FindGameObjectsWithTag("Exit")) { ExitTile tile = exit.GetComponent <ExitTile>(); if (tile.toScene.Equals(prev + '.' + dest)) { nHero = Instantiate(glossy.hero, exit.transform.position, exit.transform.rotation, GameObject.Find("Units").transform); BaseSaver.setMapConnection(""); BaseSaver.setMapPrevName(""); break; } } if (nHero != null) { nHero.GetComponent <PlayerMain>().playerMeta = meta; } else { Debug.Log("Hero is null!"); nHero = Instantiate(glossy.hero, board.playerPos.ToVector3(), Quaternion.identity, GameObject.Find("Units").transform); nHero.GetComponent <PlayerMain>().playerMeta = meta; } } else { Debug.Log("Hero is not null!"); //GameObject.FindWithTag("Player").transform.position = new Vector3(board.playerPos.x, board.playerPos.y, board.playerPos.z); GameObject.FindWithTag("Player").GetComponent <PlayerMain>().playerMeta = meta; } //GameObject.FindWithTag("Player").GetComponent<PlayerMain>().playerMeta = meta; //BoardMeta board = BaseSaver.getBoard(BaseSaver.getMap()); //Debug.Log("Player Pos: " + GameObject.Find("PlayerHero").transform.position.ToString()); if (board != null) { Debug.Log("Board not null"); GameObject[] npcs = GameObject.FindGameObjectsWithTag("NPC"); GameObject[] items = GameObject.FindGameObjectsWithTag("Item"); Debug.Log("board: " + board.mapName); Debug.Log("player pos: " + board.playerPos); foreach (GameObject npc in npcs) { Debug.Log("board npc: " + (new PosMeta(npc.transform.position)).ToString()); Debug.Log("equals battle: " + meta.trainer.pos.Equals(new PosMeta(npc.transform.position)).ToString()); foreach (NPCMeta NPCMeta in board.NPCs) { if (NPCMeta.name.Equals(npc.GetComponent <NPCMain>().meta.name)) { npc.GetComponent <NPCMain>().meta = new NPCMeta(NPCMeta); } } if (meta.trainer != null && meta.trainer.name.Equals(npc.GetComponent <NPCMain>().meta.name)) { Debug.Log("Found: " + npc.GetComponent <NPCMain>().meta.ToString()); npc.GetComponent <NPCMain>().meta = new NPCMeta(meta.trainer); Debug.Log("changed: " + npc.GetComponent <NPCMain>().meta.ToString()); } } foreach (GameObject item in items) { item.GetComponent <TreasureMain>().UpdateInteractable(); } //GameObject.FindWithTag("Player").transform.position = new Vector3(board.playerPos.x, board.playerPos.y, board.playerPos.z); BaseSaver.putBoard(GameUtilities.getBoardState(BaseSaver.getMap(), new PosMeta(GameObject.FindWithTag("Player").transform.position))); } else { Debug.Log("Board is null"); } }