void Start() { DamageAnim = GetComponent <Animator>(); playerData = PlayerData.GetInstance(); //playerData.Reset(); リセット(死んだとき) hp_Recovery = HP_Recovery.GetInstance(); currentHp = playerData.hp; Hp_Rec = hp_Recovery.Hp_Rec; CharaController = GetComponent <CharacterController>(); //Sliderを満タンにする。 //現在のHPを最大HPと同じに。 // currentHp = maxHp; checkPoint = GetComponent <CheckPoint>(); hurtPanel = GameObject.Find("PlayerHudCanvas").transform.Find("HurtPanel").gameObject; Debug.Log("Start currentHp : " + currentHp); HPUI = GameObject.Find("PlayerHudCanvas"). transform.GetChild(0).transform.GetChild(0). GetComponent <Image>(); SetHealth(playerData.maxHp); cam = GameObject.Find("CameraContainer"); camFollow = cam.GetComponent <CameraFolow>(); playerController = GetComponent <PlayerContloller>(); }
private void Start() { playerData = PlayerData.GetInstance(); cam = GameObject.Find("CameraContainer"); playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerContloller>(); camFollow = cam.GetComponent <CameraFolow>(); }
void SpawnPlayerAtEndOfRoad(int x, int y) { PlayerController player = GameManager.instance.playerController; CameraFolow cameraFollow = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraFolow>(); Vector3 tempPlayerCoordinates = roadMap.GetCellCenterWorld(new Vector3Int(x, y, 0)); Vector3 newPlayerCoordinates = new Vector3(tempPlayerCoordinates.x + 1f, tempPlayerCoordinates.y + 0.5f, tempPlayerCoordinates.z); cameraFollow.gameObject.transform.position = new Vector3(newPlayerCoordinates.x, newPlayerCoordinates.y + 0.66f, -10f); player.MoveToStartOfLevel(newPlayerCoordinates); player.moveCommandReceived = false; GameManager.instance.playerEyesWork = true; }