// Called automatically by Unity when the script is first added to a gameobject or is reset from the context menu. void Reset() { meleeWeapon = GetComponentInChildren <MeleeWeapon>(); Transform footStepSource = transform.Find("FootstepSource"); if (footStepSource != null) { footstepPlayer = footStepSource.GetComponent <RandomAudioPlayer>(); } Transform hurtSource = transform.Find("HurtSource"); /*if (hurtSource != null) * hurtAudioPlayer = hurtSource.GetComponent<RandomAudioPlayer>(); ?? */ Transform landingSource = transform.Find("LandingSource"); if (landingSource != null) { landingPlayer = landingSource.GetComponent <RandomAudioPlayer>(); } // cameraSettings = FindObjectOfType<CameraSettings>(); //todo // if (cameraSettings != null) { // if (cameraSettings.follow == null) // cameraSettings.follow = transform; // if (cameraSettings.lookAt == null) // cameraSettings.follow = transform.Find("HeadTarget"); // } }
void Start() { //agent = GetComponent<UnityEngine.AI.NavMeshAgent>(); //if (agent == null) //{ // Debug.LogError("No nav mesh agent found on sheep, aborting script!"); // enabled = false; //} //sheepDog = fleeTarget.GetComponent<Dog>(); animator = GetComponent <Animator>(); sounds = GetComponent <RandomAudioPlayer>(); /* * if (fleeTarget == null) * { * var possibleDog = FindObjectOfType<Dog>(); * if (possibleDog != null) * { * fleeTarget = possibleDog.transform; * } * } * if (followTarget == null && alphaSheep == false) * { * var newAlpha = FindObjectsOfType<Sheep>().Where(otherSheep => otherSheep.alphaSheep == true).FirstOrDefault(); * if (newAlpha != null) * { * followTarget = newAlpha.transform; * } * }*/ }
protected void Awake() { m_Button = GetComponent <Button>(); m_Button.onClick.AddListener(OnClick); //m_CountText = GetComponentInChildren<Text>(); m_backGroundImage = GetComponentsInChildren <Image>(true)[1]; m_backGroundImage.enabled = false; m_HashEffect = Gamekit2D.VFXController.StringToHash(effect); m_Audio = GetComponent <RandomAudioPlayer>(); }
void Awake() { //후에 인스펙터로 옮길 부분 batteryAudioPlayer = transform.GetChild(0).GetChild(3).GetComponent <RandomAudioPlayer>(); dieAudioPlayer = transform.GetChild(0).GetChild(5).GetComponent <RandomAudioPlayer>(); landAudioPlayer = transform.GetChild(0).GetChild(4).GetComponent <RandomAudioPlayer>();; dataBase.SetDate(transform, GetComponents <PlayerInput>(), GetComponent <Damageable>(), GetComponent <Animator>(), GetComponent <BoxCollider2D>(), GetComponent <CharacterController2D>(), GetComponent <Scoreable>()); //컴파일 시작시 초기화 구문. 컨트롤러 설정, 데미지 상호작용여부, 애니메이션, 컬라이더, 스코어링, 캐릭터컨트롤러(물리부) 초기화. //함수 자체가 초기화 함수임. f12 참조바람 m_Observer = new Observer(dataBase); var publisher = FindObjectOfType <Publisher>(); //옵저버 클래스를 하나 생성해서 초기화 해 주고, 현 씬 내의 퍼블리셔를 넣어줌. m_Observer.Subscribe(publisher); }
private void Awake() { GetComponent <CompositeCollider2D>().isTrigger = true; m_Tilemap = GetComponent <Tilemap>(); tileWay = new Vector2Int[] { new Vector2Int(-1, 0), new Vector2Int(1, 0), new Vector2Int(0, -1), new Vector2Int(0, 1), new Vector2Int(-1, 1), new Vector2Int(-1, -1), new Vector2Int(1, 1), new Vector2Int(1, -1), }; randomPlayer = GetComponent <RandomAudioPlayer>(); }
void Start() { agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); if (agent == null) { Debug.LogError("No nav mesh agent found on dog, aborting script!"); enabled = false; } animator = GetComponent <Animator>(); if (animator == null) { Debug.LogError("No animator found on dog, aborting script!"); enabled = false; } sounds = GetComponent <RandomAudioPlayer>(); if (target == null) { target = GameObject.FindObjectOfType <ControlReticle>().transform; } }
protected override void Initialise() { m_Box = GetComponent <BoxCollider2D>(); m_Rigidbody2D = GetComponent <Rigidbody2D>(); m_Rigidbody2D.bodyType = RigidbodyType2D.Static; m_GroundRaycastDistance = 0.00001f; m_RaycastDistance = m_Box.size.y * 0.5f + m_GroundRaycastDistance * 2f; m_RaycastSize = new Vector2(m_Box.size.x * 0.9f, m_RaycastDistance); PlayerOn = transform.GetChild(0).GetChild(1).GetComponent <RandomAudioPlayer>(); FallDown = transform.GetChild(0).GetChild(0).GetComponent <RandomAudioPlayer>(); if (platformCatcher == null) { platformCatcher = GetComponent <PlatformCatcher>(); } //m_PlatformType = PlatformType.FALLING; m_StartingPosition = transform.position; var rootObj = gameObject.scene.GetRootGameObjects(); foreach (var go in rootObj) { if (go.name.Equals("CellController")) { confinerBoundsMinY = go.GetComponent <CellController>().CurrentCell.ConfinerBounds.min.y; break; } } if (confinerBoundsMinY == 0) { Debug.LogError("셀 바운즈 설정 에러"); } }
private void Awake() { m_HashEndLevelEffect = VFXController.StringToHash(endLevelEffect); m_Audio = GetComponent <RandomAudioPlayer>(); }