private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { enterEvent.Post(this.gameObject); //Debug.Log("Setting layer " + enterEvent); } }
void CallFotstep() { if (playersMoving == true) { if (material == "marble") { AkSoundEngine.SetSwitch(SwitchGroup, "marble", gameObject); footevent.Post(gameObject); } if (material == "porch") { AkSoundEngine.SetSwitch(SwitchGroup, "porch", gameObject); footevent.Post(gameObject); } if (material == "stairs") { AkSoundEngine.SetSwitch(SwitchGroup, "stairs", gameObject); footevent.Post(gameObject); } } }
// Use this for initialization void Start() { if (MusicStarted == false) { GameplayMusic.Post(gameObject); MusicStarted = true; } else { Debug.Log("Music Is Already Playing"); } }
public void activatePlatform() { if (activated) { return; //don't start the delayed activate if the platform is already activated } //call this function in character controller in OnMovementHit() if it is indeed a moving platform Invoke("delayedActivatePlatform", startDelay); //Debug.Log("Platform was activated!"); startSound.Post(gameObject); }
public bool Damage(int value) { hp -= value; if (value > 0) { reduceSound.Post(gameObject); } if (hp >= 0) { transform.localScale = new Vector3(GameManager.instance.meteorScales[hp], GameManager.instance.meteorScales[hp], GameManager.instance.meteorScales[hp]); return(true); } else { stopMoveSound.Post(gameObject); reduceSound.Post(gameObject); print("destroyed"); return(false); } }
public void StartGame() { Time.timeScale = 1.0f; fadePlane.raycastTarget = true; StopAllCoroutines(); endMenuMusic.Post(gameObject); StartCoroutine(ChangeScenes(1)); }
/// <summary> /// Stops the currently running background music before changing the background music. /// </summary> public void ChangeBackgroundMusic() { if (currentBackgroundID != AkSoundEngine.AK_INVALID_PLAYING_ID) { SoundManager.StopEvent(currentBackgroundID, 100, gameObject); } if (stopAllOtherEvents) { SoundManager.StopAllEvents(); } backgroundMusicEvent.Post(gameObject); }
private IEnumerator OpenDoors() { doorsClosedStop.Post(gameObject); doorsOpenPlay.Post(gameObject); //jinglePlay?.Post(gameObject); StopCoroutine("CloseDoors"); // TO DO : Play ambiance sound while (leftDoor.transform.position != leftDoorOpenPos) { leftDoor.transform.position = Vector3.MoveTowards(leftDoor.transform.position, leftDoorOpenPos, Time.deltaTime * speed); rightDoor.transform.position = Vector3.MoveTowards(rightDoor.transform.position, rightDoorOpenPos, Time.deltaTime * speed); yield return(null); } Debug.Log("Doors opened !"); state = STATE.OPEN; isOpeningDoor = false; isClosingDoor = false; }
public void TriggerKinderSound() { m_planet.transform.localPosition = Vector3.zero; m_planet.transform.localScale = Vector3.one; foreach (MeshCollider c in m_planet.GetComponents <MeshCollider>()) { c.enabled = false; } m_kinderCreation.Post(gameObject); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { buildEvent.Post(this.gameObject); xrRig.transform.SetParent(transform); StartCoroutine(RaisePlatform()); //animator.speed = 1; turbPlayer.FadeIn(); elevPlayback.RaiseElevator(); } }
public void Pull(Transform hand) { Debug.Log("Pull"); float distance = Vector3.Distance(hand.position, m_Start.position); if (distance >= m_GrabThreshold) { return; } PullBackSound.Post(gameObject); m_PullingHand = hand; }
private void BroadcastNote(int plrSect) { switch (plrSect) { case 0: stopNotes.Post(gameObject); A3.Post(gameObject); break; case 1: stopNotes.Post(gameObject); C4.Post(gameObject); break; case 2: stopNotes.Post(gameObject); D4.Post(gameObject); break; case 3: stopNotes.Post(gameObject); F4.Post(gameObject); break; case 4: stopNotes.Post(gameObject); G4.Post(gameObject); break; case 5: stopNotes.Post(gameObject); A4.Post(gameObject); break; case 6: stopNotes.Post(gameObject); C5.Post(gameObject); break; case 7: stopNotes.Post(gameObject); D5.Post(gameObject); break; } }
public virtual eJOB_STATUT Interact(eINPUT_INTERACT inputTriggered) { eJOB_STATUT statut; if (canPerform) { onInteract?.Invoke(inputTriggered); if (inputTriggered == requiredInputs[currentInput]) { if (currentInput < requiredInputs.Length - 1) { ++currentInput; newInput?.Invoke(requiredInputs[currentInput]); statut = eJOB_STATUT.NEXT; actionNextSound.Post(gameObject); } else { currentInput = 0; newInput?.Invoke(requiredInputs[currentInput]); statut = eJOB_STATUT.SUCCEEDED; actionSuccessSound.Post(gameObject); } } else { statut = eJOB_STATUT.FAILED; actionFailSound.Post(gameObject); } } else { statut = eJOB_STATUT.FAILED; actionFailSound.Post(gameObject); } Debug.Log(statut); return(statut); }
IEnumerator BeginGenerativePhase() { makingSongState.Post(gameObject); if (gameMode != GameMode.ViewPreviousReadings && !DEBUG_SaveReadingImmediately) { SaveUtils.SaveReading(new SavedReading( System.DateTime.Now.Ticks, cardsSelectedToDeal.ToArray(), cardMeanings, false )); } generativeUI.SetMeanings(cardMeanings); float t = 0; CanvasGroup readingGroup = spreadCanvas.GetComponent <CanvasGroup>(); if (readingGroup != null) { while (t < 1.0) { t += Time.deltaTime / cardFlipSpeed; readingGroup.alpha = 1 - t; yield return(null); } } foreach (TarotCardData card in selectedCardData) { foreach (ParticleSystem ps in sparks) { float GetColorFromCardOrder(int order) { return(order < 7 ? ((order + 78) * 3) / 255f : (order * 3) / 255f); } Color particleColor = new Color32(); particleColor.r = GetColorFromCardOrder(selectedCardData[0].order); particleColor.g = GetColorFromCardOrder(selectedCardData[1].order); particleColor.b = GetColorFromCardOrder(selectedCardData[2].order); particleColor.a = 255; ParticleSystem.MainModule ma = ps.main; ma.startColor = particleColor; ps.Play(); } } Cursor.SetCursor(waitCursor, Vector2.zero, CursorMode.Auto); yield return(StartCoroutine(generativeUI.FadeIn())); yield return(StartCoroutine(generativeUI.ReadText())); Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); SetGameState(GameState.ShowingGenerativeUITransitionalText); }
void CallFootsteps() { if (playerismoving == true) { //Debug.Log ("Player is moving"); if (Physics.Raycast(gameObject.transform.position, Vector3.down, out RaycastHit hit, 1f, lm)) { AkSoundEngine.SetSwitch("Surface", hit.collider.tag, gameObject); } inputsound.Post(gameObject); Debug.Log(hit.collider.tag); } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.layer == 10) { slamSound.Post(gameObject); origiPos = false; } if (collision.gameObject.layer == 9) { player.GetComponent <PlayerStats>().Die(); } }
void Playfootstep(GameObject footObject) // функция проверки поверхности для нужного геймобъекта { //Debug.Log("123"); // Debug.Log(hero.gameObject.transform.forward.magnitude); if (Physics.Raycast(footObject.transform.position, Vector3.down, out RaycastHit hit, 0.3f)) // запускаем рейкаст из объекта нужной ноги вниз { //Debug.Log("123"); AkSoundEngine.SetSwitch("surface_type_Run", hit.collider.tag, footObject); // выставляем свитч нужной свитч-группы в положение такое же как тэг поверхности, на которую наступила нога, применяем свитч для нужной ноги footevent.Post(footObject); // запускаем ивент для из нужной ноги Debug.Log(hit.collider.tag); } }
private void OnSpawn() { Debug.Log("PS::Player spawned at " + spawnCoord); AC.SetBool("isMoving", false); PC.FreezePlayer(); transform.position = spawnCoord; transform.rotation = Quaternion.Euler(spawnRot); ResetGhosts(); AnimateGhosts(); AC.SetTrigger("OnSpawn"); status = Player_Status.spawning; sproutingEvent.Post(gameObject); }
void EngineStarting() { if ((EngineStalled == 1f) && (engineLoad > 0f) && (StartSound == false)) { EngineSound.Post(gameObject); print("PlaySound"); StartSound = true; } if (engineRpm == 0) { EngineStop.Post(gameObject); print("Stopped"); StartSound = false; } if (Input.GetKeyDown(KeyCode.Escape)) { EngineStop.Post(gameObject); StartSound = false; } }
public void ButtonIncrement(int layer) { InventorySelectSound.Post(gameObject); if (Panel.activeInHierarchy && hasShown) { if (layer == 0) { SelectIncrementor_Row1++; ApplyInventoryInfo2Single_Right(OriginalPositions.Row1, InventoryReference.Items, SelectIncrementor_Row1, Scales[0], ItemIcon); } else if (layer == 1) { SelectIncrementor_Row2++; ApplyInventoryInfo2Single_Right(OriginalPositions.Row2, InventoryReference.Weapons, SelectIncrementor_Row2, Scales[1], WeaponIcon); } else if (layer == 2) { SelectIncrementor_Row3++; ApplyInventoryInfo2Single_Right(OriginalPositions.Row3, InventoryReference.Items, SelectIncrementor_Row3, Scales[2], ItemIcon); } } }
void OnCollisionEnter(Collision col) { if (col.gameObject.layer == LayerMask.NameToLayer("Weapon")) { CoreDestructionSound.Post(gameObject); PlayerManager.Instance.cameraScript.CamShake(new PlayerCamera.CameraShake(0.5f, 0.5f)); GameManager.Instance.gameSpeedHandler.SetGameSpeed(gameObject.GetInstanceID(), 0.1f, 0.1f, 0.1f, 1f); GameObject vfx = Instantiate(spawnOnDestruction, transform.position, Quaternion.identity, SceneStructure.Instance.TemporaryInstantiations.transform); Destroy(vfx, 5f); Destroy(gameObject); } }
// Rotate the blade based on which button is pressed - possibly done with animations in future void RotateBlade(Button button) { // Set the blade rotation position if (button == leftButton) { blade.transform.Rotate(0, 0, -60); } else if (button == rightButton) { blade.transform.Rotate(0, 0, 60); } // Play the slicing sound sliceSound.Post(blade); }
void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.layer != 8) { return; } FindObjectOfType <MetaballManager>().AddInfluencingAbility(); WaterCollides.Post(gameObject); Destroy(collision.gameObject); if (++hits == collisionsUntilDestroy) { Destroy(gameObject); } }
public void TakeDamage(int damage) { damagetaken.Post(gameObject); animator.SetTrigger("Hurt"); currentHealth -= damage; healthui.SetHealth(currentHealth); knockbackCount = knockbackLength; if (currentHealth <= 0) { animator.SetTrigger("Death"); StartCoroutine(DeathAnim()); } }
void Awake() { currentScene = SceneManager.GetActiveScene(); if (currentScene.name == "MainMenu") { titleMusicState.SetValue(); currentMusic.Post(gameObject); } else if (currentScene.name == "SpaceShooter") { levelMusicStates[0].SetValue(); } }
void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.tag == "PosBall" || collision.collider.tag == "MinusBall") { particleSpeed.SetValue(gameObject, speed); Collision.Post(gameObject); } else { particleSpeed.SetValue(gameObject, speed); WallCollision.Post(gameObject); } }
void MonsterImpact() // Name of soundfile { if (Debug_Enabled) { Debug.Log("MonsterImpact Triggered"); } SoundEvent.Post(gameObject); }
// Update is called once per frame void Update() { if (m_isOpening) { transform.position = Vector3.MoveTowards(transform.position, m_openStatePos, m_speed * Time.deltaTime); if (transform.position.y == m_openStatePos.y) //if already open { stopEvent.Post(this.gameObject); //Debug.Log("Stop Event; " + transform.position + " --- " + m_openStatePos); } } else { transform.position = Vector3.MoveTowards(transform.position, m_closedStatePos, m_speed * Time.deltaTime); //print(string.Format("{0} == {1}", transform.position, m_closedStatePos)); if (transform.position.y == m_closedStatePos.y) //if already closed { stopEvent.Post(this.gameObject); //Debug.Log("Stop Event; " + transform.position + " --- " + m_closedStatePos); } } }
protected override bool PlayInternal() { uint callbackFlags = (uint)(AkCallbackType.AK_EnableGetMusicPlayPosition | AkCallbackType.AK_MusicSyncEntry | AkCallbackType.AK_EndOfEvent); playingId_ = Event.Post(this.gameObject, callbackFlags, AkEventCallback); TransitionState = ETransitionState.Intro; if (seekTiming_ != null && seekTiming_ >= Timing.Zero) { AkSoundEngine.SeekOnEvent(Event.Id, gameObject, (int)DefaultMeter.GetMilliSecondsFromTiming(seekTiming_)); } return(playingId_ != AkSoundEngine.AK_INVALID_PLAYING_ID); }
void Update () { if(GetComponent<Rigidbody2D>().velocity.magnitude >= 0.1 && !didItPlay) { MovingSound.Post(gameObject); didItPlay = true; Velocity.SetValue(gameObject, GetComponent<Rigidbody2D>().velocity.magnitude); } else if (GetComponent<Rigidbody2D>().velocity.magnitude == 0 && didItPlay) { StopMovingSound.Post(gameObject); didItPlay = false; }