void Awake() { if (instance == null) { instance = this; } }
// add variable to store audioclip //is Tripleshot active? // // Start is called before the first frame update void Start() { score = 0; // take current pos and assign start pos. transform.position = new Vector3(0, 0, 0); _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>();//find the object. Get the component. _uiManager = GameObject.Find("Canvas").GetComponent <UIManger>(); _singleShotAudioSource = GameObject.Find("SingleShot_Audio").GetComponent <AudioSource>(); _healthPointsPlayer = 3; if (_spawnManager == null) { Debug.LogError("Spawn Manager is currently NULL. ::PLAYER::"); } if (_uiManager == null) { Debug.LogError("UI Manager is currently NULL."); } if (_singleShotAudioSource == null) { Debug.LogError("Single Shot Audio Source is currently NULL. ::PLAYER::"); } }
private void SetTouchListener() { Button btn = gameObject.transform.GetComponent <Button>(); TouchEventListener listener = btn.gameObject.AddComponent <TouchEventListener>(); // 鼠標抬起事件 listener.OnMouseUp += delegate(GameObject gb) { GameState nowState = GameObject.Find("GameView").transform.GetComponent <GameView>().GetNowStae(); if (nowState != GameState.IsMeRank || btn.transform.parent.name != "PlayerDeck") { return; } if (CheckCardIsSelected() ? SetCardCancel() : SetCardSelect()) { UIManger UIManger = GameObject.FindGameObjectWithTag("UIManger").GetComponent <UIManger>(); if (CheckCanPassCard()) { UIManger.btn_PassCards.interactable = true; } else { UIManger.btn_PassCards.interactable = false; } } }; }
void Start() { transform.position = new Vector3(0, 0, 0); _spawnManager = GameObject.Find("Spawn_Manager").GetComponent <SpawnManager>(); _uiManager = GameObject.Find("Canvas").GetComponent <UIManger>(); _audioSource = GetComponent <AudioSource>(); if (_spawnManager == null) { Debug.LogError("The Spawn Manager is NULL."); } if (_uiManager == null) { Debug.LogError("The UI Manger is NULL."); } if (_audioSource == null) { Debug.LogError("AudioSource on the player is NULL."); } else { _audioSource.clip = _laserSoundClip; } }
public NotifyManger NotifyManger; // 玩家順序管理 // Use this for initialization void Start() { m_deck = new Deck(); UIManger = GameObject.FindGameObjectWithTag("UIManger").GetComponent <UIManger>(); NotifyManger = GameObject.Find("NotifyManger").GetComponent <NotifyManger>(); InitPlayer(); m_state = GameState.None; }
public UIFacade(UIManger uiManager) { this.uiManger = uiManager; gameManager = GameManager.Instance; playerManager = GameManager.Instance.playerManager; audioSourceManager = GameManager.Instance.audioSourceManager; InitMask(); }
private void Awake() { DontDestroyOnLoad(gameObject); _instance = this; playerManager = new PlayerManager(); factoryManager = new FactoryManager(); audioSourceManager = new AudioSourceManager(); uiManger = new UIManger(); uiManger.mUIFacade.currentSceneState.EnterScene(); }
public Player(GameView gamescene, int seat) { this.gamescene = gamescene; HandCards = new List <Card>(); this.IsFistPlayer = false; deck = gamescene.transform.GetChild(seat).gameObject; this.seat = seat; UIManger = GameObject.Find("UIManger").GetComponent <UIManger>(); gamescene.NotifyManger.RegisterPlayer(this); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this.gameObject); } }
private void Awake() { knife = GameObject.Find("knife_unity"); fadeinout = FindObjectOfType <FadeInOut>(); mainCamera = FindObjectOfType <Camera>(); gameManager = transform.GetComponent <GameManager>(); heroineEventSetting = FindObjectOfType <HeroineEventSetting>(); particleManager = transform.GetComponent <ParticleManager>(); animationManager = transform.GetComponent <AnimationManager>(); itemtext = GameObject.Find("SphereItem 1").transform.Find("ItemCanvas").transform.Find("PickUpText").gameObject; // arrow = GameObject.Find("SphereItem 1").transform.Find("ItemCanvas").transform.Find("Arrow").gameObject; // arrowColor = arrow.GetComponent <SpriteRenderer>().color; uIManger = FindObjectOfType <UIManger>(); }
IEnumerator LerpPosition() { islerping = true; while ((playerInstance.transform.position - destination).sqrMagnitude > 0.0001f) { playerInstance.transform.position = Vector3.MoveTowards(playerInstance.transform.position, destination, moveSpeed * Time.deltaTime); yield return(null); } playerInstance.transform.position = destination; DungeonMapData _data = DungeonManager.GetMapData((int)destination.x, (int)destination.z); if ((_data.itemType != Item.ItemType.empty)) { AddItem(_data.itemData); DungeonManager.ChangeItemType((int)destination.x, (int)destination.z, Item.ItemType.empty); } islerping = false; if (_data.cubeType == E_DUNGEON_CUBE_TYPE.HOME) { if (instance.food > 0) { IncreaseSatiation(instance.food); SetFood(0); UIManger.instance.ShowSystemText(); UIManger.StartChangeMap(); } CameraManager.instance.cmrAnimator.SetBool("inHome", true); } else { if (_data.cubeType == E_DUNGEON_CUBE_TYPE.WATER) { ParticleManager.ShowParticle((int)destination.x, (int)destination.z, E_PARTICLE_TYPE.WATER); } CameraManager.instance.cmrAnimator.SetBool("inHome", false); IncreaseSatiation(-1f); } // Fuse (slimeMode, _data.itemType); }
public void GameOverDone() { UIManger.GameOverDone(); }
public Image healthBar;//角色血条 void Awake() { instance = this; }
private void Awake() { Instance = this; }
// Called Every Frame private void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { SetSlimeMode(Item.ItemType.milk); } else if (Input.GetKeyDown(KeyCode.Alpha2)) { SetSlimeMode(Item.ItemType.oil); } else if (Input.GetKeyDown(KeyCode.Alpha3)) { SetSlimeMode(Item.ItemType.acid); } else if (Input.GetKeyDown(KeyCode.Alpha4)) { SetSlimeMode(Item.ItemType.butter); } else if (Input.GetKeyDown(KeyCode.Alpha5)) { SetSlimeMode(Item.ItemType.yogurt); } else if (Input.GetKeyDown(KeyCode.Alpha6)) { SetSlimeMode(Item.ItemType.poison); } // homeArrawRota Vector3 _ray = new Vector3(DungeonManager.homePos.x, 0, DungeonManager.homePos.y) - destination; Vector3 _euler = Vector3.zero; if (_ray != Vector3.zero) { _euler = Quaternion.LookRotation(_ray).eulerAngles; } else { // Since we initlaize to zero, no need to re-assign // _euler = Vector3.zero; } homeArrawRota = _euler.y; UIManger.instance.UpdateArraw(); if ((health <= 0) || (satiation <= 0)) { if (!GameOverManager.isGameOver) { playerInstance.GetComponent <Animator>().SetTrigger("isDead"); GameOverManager.isGameOver = true; UIManger.StartGameOver(); } return; } if (isIdle) { GetNextStepTranslate(); } CheckDropItemAction(); }
void Awake() { uIManger = GameObject.Find("UIManger").GetComponent <UIManger>(); }
void Update() { if (resized == false) { ResizingWeight(weight); UIManger ui = GameObject.Find("UI").GetComponent <UIManger>(); ui.ShowMapIcon(this.hasMap); resized = true; } // 체중 감량과 애니메이션 if (Input.GetMouseButtonDown(1)) { LoosingWeight(); } else if (Input.GetMouseButtonUp(1)) { anim.SetBool("DoingExercise", false); } if (Cursor.visible == true) { anim.SetInteger("WalkParam", 0); isWalking = false; return; } MoveCharacter(); // 플레이어 이동 if (isWalking && isGrounded) { audio.clip = AudioClips[0]; audio.volume = 0.5f; if (audio.isPlaying == false) { audio.Play(); } } else { audio.Stop(); } // 잡기 if (Input.GetMouseButtonDown(0)) { if (!EventSystem.current.IsPointerOverGameObject()) { RaycastHit hit; Debug.DrawRay(transform.position, transform.forward * 10.0f, Color.blue, 0.3f); if (Physics.Raycast(transform.position, transform.forward, out hit, 10.0f) && hit.transform.CompareTag("Slime")) { isGrabbing = !isGrabbing; if (isGrabbing) { grab = hit.transform.gameObject; if (grab.transform.Find("Body").CompareTag("Slime")) { grab.GetComponent <Slime>().Estate = Slime.STATE.CATCHED; } grab.transform.SetParent(this.gameObject.transform); } } else if (Physics.Raycast(transform.position, transform.forward, out hit, 10.0f) && hit.transform.CompareTag("Scale") && grab != null) { hit.transform.GetComponent <Scale>().CheckMonster(); isGrabbing = false; grab = null; } } } if (grab != null) { GrabObject(); } }
private void OnApplicationQuit() { instance = null; }
public void ChangeMapDone() { UIManger.ChangeMapDone(); }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("Ground")) { isGrounded = true; } // 덤벨 획득 시 감량 하한 체중 재설정 if (collision.gameObject.CompareTag("Dumbbell")) { audio.clip = AudioClips[3]; audio.volume = 1.0f; audio.Play(); dumCounts += 1; // 획득한 덤벨 개수 추가 minWeight -= 10 * dumCounts; // 체중 하한 재설정 PlayerPrefs.SetInt("Dumb", dumCounts); Destroy(collision.gameObject); } // 연료 획득 시 연료량 상한 재설정 else if (collision.gameObject.CompareTag("Fuel")) { audio.clip = AudioClips[3]; audio.volume = 1.0f; audio.Play(); Destroy(collision.gameObject); maxFuel += 5.0f; if (maxFuel > 11) { maxFuel = 11; } PlayerPrefs.SetInt("Fuel", (int)maxFuel); } // 음식 섭취 시 체중 증가 else if (collision.gameObject.CompareTag("Food")) { audio.clip = AudioClips[3]; audio.volume = 1.0f; audio.Play(); weight = maxWeight; this.gameObject.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f); Destroy(collision.gameObject); } // 슬라임 접촉 시 데미지 else if (collision.gameObject.CompareTag("Slime")) { hp -= 10; StartCoroutine("SetImmortalTimer"); } else if (collision.gameObject.CompareTag("Key") && this.hasKey == false) { audio.clip = AudioClips[3]; audio.volume = 1.0f; audio.Play(); this.hasKey = true; Destroy(collision.gameObject); UIManger ui = GameObject.Find("UI").GetComponent <UIManger>(); ui.ShowKeyIcon(this.hasKey); PlayerPrefs.SetInt("Key", 1); } else if (collision.gameObject.CompareTag("Map") && this.hasMap == false) { audio.clip = AudioClips[3]; audio.volume = 1.0f; audio.Play(); this.hasMap = true; Destroy(collision.gameObject); UIManger ui = GameObject.Find("UI").GetComponent <UIManger>(); ui.ShowMapIcon(this.hasMap); PlayerPrefs.SetInt("Map", 1); } }