コード例 #1
0
 private void Block(Vector3 hitpoint)
 {
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ObstacleBlock, audioEvents, gameObject);
     cameraShake.setShakeElapsedTime(breakShake / 2);
     //dialogRunner.StartDialogue("Block");
     movementController.Collide(hitpoint);
 }
コード例 #2
0
    /// <summary>
    /// Performs Dash Action.
    /// </summary>
    public void Dash(Vector3 dashDirection)
    {
        if (IsMoving)
        {
            TriggerCoyoteTime = true;
            return;
        }

        // checks if you have enough moves left for a dash
        int movesLeft = AmountOfMoves - DashCost;

        if (movesLeft < 0)
        {
            AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ChargingRejection, audioEvents, gameObject);
            StartCoroutine(ChangeTextColorRoutine());
            return;
        }

        attachToPlane.Detach();

        isDashing             = true;
        trailRenderer.enabled = true;
        previousPosition      = transform.position;
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ChargedDash, audioEvents, gameObject);
        previousPosition = transform.position;
        Vector3 targetPosition = transform.position + dashDirection * DashDistance;

        StartCoroutine(MoveRoutine(targetPosition, DashDuration, DashCost));

        ResetDash();
    }
コード例 #3
0
 private void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OnCollision, audioEvents, gameObject);
     }
 }
コード例 #4
0
 private void BurnProp(Vector3 hitpoint)
 {
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.BurningItem, audioEvents, gameObject);
     gameObject.GetComponent <BurnObject>().SetObjectOnFire(hitpoint);
     movementController.UpdateFireAmount(-HealValue);
     _breakablesParticleManager.SmallPollBreakableParticles(hitpoint);
 }
コード例 #5
0
    public void EnablePopUpButton()
    {
        GameObject canvas = GameObject.FindGameObjectWithTag(PopUpCanvasTag);

        if (canvas == null)
        {
            Debug.LogWarning("Unable to find Pop-up canvas to display image on");
        }
        else
        {
            if (gameObject.CompareTag("pic1"))
            {
                AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.PictureOff_01, audioEvents, gameObject);
            }
            else if (gameObject.CompareTag("pic2"))
            {
                AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.PictureOff_02, audioEvents, gameObject);
            }
            else if (gameObject.CompareTag("pic3"))
            {
                AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.PictureOff_03, audioEvents, gameObject);
            }
            else if (gameObject.CompareTag("pic4"))
            {
                AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.PictureOff_04, audioEvents, gameObject);
            }

            PopUpCanvas popUpCanvasComponent = canvas.GetComponent <PopUpCanvas>();
            popUpCanvasComponent.EnableButton();
        }
    }
コード例 #6
0
    /*private void OnCollisionEnter(Collision collision)
     * {
     *  if (collision.gameObject.tag != "Player")
     *  {
     *      if (transform.childCount > 1)
     *      {
     *          transform.Find("Player").GetComponent<AttachToPlane>().Detach(false);
     *          _destroyThis = true;
     *      }
     *
     *      _destroyThis = true;
     *
     *  }
     * }*/

    public override void Interact(GameObject player)
    {
        // Play sound
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OnPlane, audioEvents, gameObject);

        // Attach Player to PaperPlane
        playerAttached       = player.GetComponent <AttachToPlane>();
        playerAttachedToThis = true;

        player.transform.SetParent(gameObject.transform);
        player.transform.position = player.transform.parent.position;
        player.GetComponent <Rigidbody>().useGravity = false;
        player.GetComponent <Rigidbody>().velocity   = new Vector3();
        playerAttached._attached = true;

        //turn flame on
        player.GetComponent <FlameAttachToggler>().FlameOn();

        // Update Animator
        player.GetComponent <MovementController>().CollidePaperPlane();

        isBurning = true;

        //Debug.Log("Collision with: " + gameObject.name);
    }
コード例 #7
0
    IEnumerator Unlock()
    {
        yield return(new WaitForSeconds(DelaySeconds));

        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.GateUnlocked, audioEvents, gameObject);
        gameObject.SetActive(false);
    }
コード例 #8
0
 public void Win()
 {
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.WinPuzzle, audioEvents, gameObject);
     GameEnd();
     WinText.SetActive(true);
     NextSceneButton.SetActive(true);
 }
コード例 #9
0
    private void StopFollowing()
    {
        if (!alreadyFinished)
        {
            isMoving = false;
            isUsed   = true;
            if (OnlyUsedOnce)
            {
                gameObject.SetActive(false);
            }
            if (generated.transform.parent != null)
            {
                generated.transform.parent = null;
            }
            movementController.IsFuseMoving = false;
            alreadyFinished = true;
            AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OffRope, audioEvents, gameObject);
            _flameAttachToggler.FlameOff();

            movementController.IsInvulnerable = false;
            if (playerRigidbody != null)
            {
                playerRigidbody.velocity = Vector3.zero;
            }
            movementController.StopMoving(InteractibleObject.InteractType.Fuse);
        }
    }
コード例 #10
0
    /// <summary>
    /// Performs Dash Action if charged or Move otherwise.
    /// </summary>
    public void Release(Vector3 direction)
    {
        // Play Animation
        _anim.Release();

        // Play Sound
        AudioEvent.SendAudioEvent(
            IsDashing ? AudioEvent.AudioEventType.ChargedDash : AudioEvent.AudioEventType.Dash,
            _audioEvents,
            gameObject
            );

        // Initiate Vibration
        if (IsDashing)
        {
            Vibration.Vibrate(200);
        }

        // Perform Action
        _attachToPlane.Detach();
        StartCoroutine(MoveRoutine(
                           transform.position + direction * (IsDashing ? DashDistance: MoveDistance),
                           IsDashing ? DashDuration : MoveDuration
                           ));

        // Reset State
        IsCharging = false;
        IsDashing  = false;
        _dashTimer = 0;
    }
コード例 #11
0
 private void DamagePlayer(Vector3 hitpoint)
 {
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.Damage, audioEvents, gameObject);
     Vibration.Vibrate(100);
     movementController.UpdateFireAmount(DamageValue);
     movementController.CheckFireLeft();
 }
コード例 #12
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OnCollision, audioEvents, gameObject);
         Debug.Log("SKIFT MUSIK!");
     }
 }
コード例 #13
0
 public void GameOverOutOfMoves()
 {
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OutOfMoves, audioEvents, gameObject);
     GameEnd();
     OutOfMovesText.SetActive(true);
     _fadeout.StartFade();
     StartCoroutine(WaitForRestart());
 }
コード例 #14
0
 private void TurnOn()
 {
     _particleSystem.Play();
     _boxCollider.enabled = true;
     _isActivated         = true;
     _timer = 0;
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.WaterSprayOn, _audioEvents, gameObject);
 }
コード例 #15
0
 public void GameOverDied()
 {
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.Died, audioEvents, gameObject);
     GameEnd();
     DiedText.SetActive(true);
     _fadeout.StartFade();
     StartCoroutine(WaitForRestart());
 }
コード例 #16
0
 private void TurnOff()
 {
     _particleSystem.Stop();
     _boxCollider.size    = new Vector3(_minColliderXValue, _boxCollider.size.y, _boxCollider.size.z);
     _colliderExpandTimer = 0;
     _boxCollider.enabled = false;
     _isActivated         = false;
     _timer = 0;
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.WaterSprayOff, _audioEvents, gameObject);
 }
コード例 #17
0
    private void PickUp()
    {
        //dialogRunner.StartDialogue("PickUp");
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.BurningItem, audioEvents, gameObject);
        gameObject.GetComponent <Collider>().enabled = false;
        gameObject.SetActive(false);
        //movementController.CollidePickUp();

        movementController.UpdateFireAmount(-HealValue);
    }
コード例 #18
0
    /// <summary>
    /// Call on every frame of charging. Handles charging and Animator
    /// </summary>
    public void Charge(bool dashIntent)
    {
        // First time called: Fire Animator's Trigger
        if (!IsCharging)
        {
            // Update Animator
            _anim.Charge();

            // Update State
            IsCharging  = true;
            IsDashing   = false;
            _dashIntent = false;
            _dashTimer  = 0;
        }

        // Intent Move
        if (!dashIntent)
        {
            // Play Sound
            if (IsDashing)
            {
                AudioEvent.SendAudioEvent(
                    AudioEvent.AudioEventType.DashCancelled,
                    _audioEvents,
                    gameObject);
            }

            // Update Intent and State
            IsDashing   = false;
            _dashIntent = false;
            _dashTimer  = 0;
        }

        // Intent Charge (unfinished)
        else if (!IsDashing)
        {
            // Update Intent and State
            _dashIntent = true;
            _dashTimer += Time.deltaTime;
            if (_dashTimer >= DashThreshold)
            {
                _dashTimer = DashThreshold;
                DashCharged();
            }
        }

        // Intent Charge (finished) -> Do nothing

        // Update the charging progress ScriptableObject
        DashHoldPercentage.Value = _dashTimer / DashThreshold;

        // Update Animator
        _anim.SetIsDashing(_dashIntent);
        _anim.SetDashCharged(IsDashing);
    }
コード例 #19
0
 private void StartFollowing()
 {
     generated = Follower;
     generated.transform.parent        = gameObject.transform;
     movementController.IsFuseMoving   = true;
     movementController.IsInvulnerable = true;
     isMoving        = true;
     alreadyFinished = false;
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OnRope, audioEvents, gameObject);
     _flameAttachToggler.FlameOn();
 }
コード例 #20
0
 private void CollidePickUp(Collision collision)
 {
     AmountOfMoves += PickUpValue;
     if (AmountOfMoves > maxAmountOfMoves)
     {
         AmountOfMoves = maxAmountOfMoves;
     }
     MovesText.text = AmountOfMoves.ToString();
     dialogRunner.StartDialogue("PickUp");
     AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.BurningItem, audioEvents, gameObject);
     Destroy(collision.gameObject);
 }
コード例 #21
0
    private void CollideBlockObstacle(Collision collision)
    {
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ObstacleBlock, audioEvents, gameObject);
        dialogRunner.StartDialogue("Block");
        hitWall = true;
        StopMoving();
        var collisionPoint = collision.contacts[0];
        var heading        = previousPosition - collisionPoint.point;

        heading.y = 0;
        StartCoroutine(MoveRoutine(collisionPoint.point + heading.normalized * BounceValue, MoveDuration));
    }
コード例 #22
0
    /// <summary>
    /// Performs Move Action.
    /// </summary>
    public void Move(Vector3 moveDirection)
    {
        if (IsMoving)
        {
            TriggerCoyoteTime = true;
            return;
        }

        previousPosition = transform.position;
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.Dash, audioEvents, gameObject);
        Vector3 targetPosition = transform.position + moveDirection * MoveDistance;

        StartCoroutine(MoveRoutine(targetPosition, MoveDuration, MoveCost));
    }
コード例 #23
0
    /// <summary>
    /// Sets the Dash charged.
    /// </summary>
    private void DashCharged()
    {
        IsDashing = true;

        // Update Animator
        _anim.SetIsDashing(true);
        _anim.SetDashCharged(true);

        // Play sound
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ChargingDash, _audioEvents, gameObject);

        // Vibrate
        Vibration.Vibrate(80);
    }
コード例 #24
0
    /// <summary>
    /// Visualizes charging the dash.
    /// </summary>
    public void ChargeDash()
    {
        material.color = new Color(1, colorValue, colorValue, 1);
        colorValue    -= 0.05f;

        // Play Animation
        animator.SetTrigger(StartLongDashTrigger);

        if (!_hasRun)
        {
            // Debug.Log("Charging");
            AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ChargingDash, audioEvents, gameObject);
            _hasRun = true;
        }
    }
コード例 #25
0
    private void OnParticleCollision(GameObject col)
    {
        if (col.CompareTag("Player"))
        {
            MovementController movementController = col.GetComponent <MovementController>();
            Rigidbody          playerRigidbody    = col.GetComponent <Rigidbody>();
            if (!movementController.DamageCoolDownActivated)
            {
                movementController.DamageCoolDownActivated = true;

                // damage player
                InteractibleObject interactibleObject = GetComponent <InteractibleObject>();
                if (interactibleObject != null && interactibleObject.type == InteractibleObject.InteractType.Damage)
                {
                    interactibleObject.Interact(transform.position);
                }
            }

            if (movementController.IsFuseMoving)
            {
                return;
            }

            // bump player back
            if (ParticlesOnCollision != null)
            {
                Vector3 position = movementController.transform.position;
                position.y = 0.5f;
                Instantiate(ParticlesOnCollision, position, Quaternion.identity);
                AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.HurtPlayer, _audioEvents, gameObject);
            }

            if (movementController.IsMoving)
            {
                Vector3 targetPos = movementController.transform.position -
                                    movementController.transform.forward * movementController.DamageBounceValue;
                targetPos.y = 0;
                StartCoroutine(movementController.MoveBackRoutine(targetPos, MovementController.MoveDuration));
            }
            else
            {
                _particleSystem.GetCollisionEvents(col, _collisionEvents);
                Vector3 collisionForce = _collisionEvents[0].velocity;
                collisionForce.y = 0;
                playerRigidbody.AddForce(collisionForce * WaterForce);
            }
        }
    }
コード例 #26
0
    private void DashEnded()
    {
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.DashEnded, audioEvents, gameObject);

        trailRenderer.enabled = false;
        IsMoving = false;

        if (isDashing)
        {
            isDashing = false;
        }

        HealthPercentage.Value = ((float)AmountOfMoves / (float)maxAmountOfMoves) * 100f;
        UpdateGoalDistances();

        // Play Animation
        animator.SetTrigger(LandTrigger);
    }
コード例 #27
0
 private void Break(Vector3 hitpoint)
 {
     if (movementController.IsDashing)
     {
         AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ObstacleBreak, audioEvents, gameObject);
         gameObject.GetComponentInChildren <Animator>()?.SetBool(BrokenBool, true);
         cameraShake.setShakeElapsedTime(breakShake);
         //timeSlowdown.doSlowmotion();
         gameObject.GetComponent <BurnObject>().SetObjectOnFire(hitpoint);
         //dialogRunner.StartDialogue("Break");
         movementController.UpdateFireAmount(-HealValue);
         _breakablesParticleManager.PollBreakableParticles(hitpoint);
     }
     else
     {
         cameraShake.setShakeElapsedTime(breakBounceShakeDur);
         AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ObstacleBreakMute, audioEvents, gameObject);
         movementController.Collide(hitpoint);
     }
 }
コード例 #28
0
    IEnumerator Unlock()
    {
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.GateUnlocked, audioEvents, gameObject);

        yield return(new WaitForSeconds(animationDelay));

        if (gameObject.CompareTag("BigDoorKey1") && AnimatorFromGameobject.GetBool("Unlock 1") == false)
        {
            AnimatorFromGameobject.SetBool("Unlock 1", true);
        }
        else if (gameObject.CompareTag("BigDoorKey1"))
        {
            coliiderFromDoor.enabled = false;
            AnimatorFromGameobject.SetBool("Unlock 2", true);
        }
        else if (gameObject.CompareTag("SmallKey"))
        {
            coliiderFromDoor.enabled = false;
            AnimatorFromGameobject.SetBool("Unlocked", true);
        }
    }
コード例 #29
0
 private void CollideBreakObstacle(Collision collision)
 {
     if (isDashing)
     {
         collision.gameObject.GetComponent <BurnObject>().SetObjectOnFire(collision.contacts[0].point);
         cameraShake.setShakeElapsedTime(breakBounceShakeDur);
         AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ObstacleBreak, audioEvents, gameObject);
         dialogRunner.StartDialogue("Break");
         cameraShake.setShakeElapsedTime(breakShake);
     }
     else
     {
         AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.ObstacleBreakMute, audioEvents, gameObject);
         StopMoving();
         cameraShake.setShakeElapsedTime(breakBounceShakeDur);
         var collisionPoint = collision.contacts[0];
         var heading        = previousPosition - collisionPoint.point;
         heading.y = 0;
         StartCoroutine(MoveRoutine(collisionPoint.point + heading.normalized * BounceValue, MoveDuration));
     }
 }
コード例 #30
0
    /// <summary>
    /// CoRoutine responsible for moving the Player.
    /// </summary>
    private IEnumerator MoveRoutine(Vector3 target, float duration)
    {
        // Before Movement
        CanAttachToPlane = true;

        _moveTweener?.Kill();

        UpdateFireAmount(IsDashing ? DashCostInPercentage : MoveCostInPercentage);

        TargetPosition = target;
        IsMoving       = true;

        CheckCollision();

        _moveTweener = _rigidBody.DOMove(TargetPosition, duration);
        _moveTweener.SetEase(IsDashing ? DashEase : MoveEase);


        yield return(new WaitForSeconds(duration * planeAttachTime));

        CanAttachToPlane = false;

        yield return(new WaitForSeconds(duration * (1 - planeAttachTime)));

        // After Movement
        CheckFireLeft();
        AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.DashEnded, _audioEvents, gameObject);

        IsMoving  = false;
        IsDashing = false;

        HealthPercentage.Value = _currentFireAmount;
        UpdateGoalDistances();

        // Notify Sally
        _salamanderController?.AddTarget(EventType.Move, transform.position);

        _rigidBody.velocity = Vector3.zero;
        FuseEvent.Invoke();
    }