Exemple #1
0
    /// <summary>
    /// Funzione che manda il player nello stato normale
    /// </summary>
    private IEnumerator NormalCoroutine()
    {
        collisionCtrl.CheckEnemyCollision(false);
        collisionCtrl.CheckDamageableCollision(false);
        shootCtrl.SetCanAim(false);
        shootCtrl.SetCanShoot(false);
        ChangeGraphics(playerGraphic, !(parasiteCtrl.GetParasite().GetControllableType() == ControllableType.Platform));
        animCtrl.SetAnimatorController(null);
        shootCtrl.ChangeShotType(shootCtrl.GetPlayerDefaultShotSetting());

        movementCtrl.Eject(parasiteCtrl.GetParasite());
        parasiteCtrl.GetParasite().EndParasite();

        if (playerSM.OnPlayerNormal != null)
        {
            playerSM.OnPlayerNormal();
        }

        if (collisionCtrl.GetCollisionInfo().HorizontalCollision())
        {
            Vector3 fixOffsetVector = PlayerInputManager.GetMovementVector();
            transform.position -= (fixOffsetVector * 0.5f);
        }

        #region Animazione (per ora fatta a caso)
        activeGraphic.GetModel().transform.DOScale(1, 0.5f);
        yield return(null);

        #endregion

        shootCtrl.SetCanAim(true);
        shootCtrl.SetCanShoot(true);
        collisionCtrl.CheckEnemyCollision(true);
        collisionCtrl.CheckDamageableCollision(true);
    }
 private void HandlePlayerMovement(Vector3 _movementVelocity, CollisionInfo _collisions)
 {
     if (collisionCtrl.GetCollisionInfo().below&& (_movementVelocity.x > 0.01f || _movementVelocity.x < -0.01f))
     {
         PlayAudioClip(walk);
     }
 }
Exemple #3
0
    private void Update()
    {
        if (canMove)
        {
            //Leggo input orrizontali e verticali
            input = PlayerInputManager.GetMovementVector();
            CalculateVelocity();

            Move();

            if (collisionCtrl.GetCollisionInfo().below || collisionCtrl.GetCollisionInfo().above)
            {
                //Se sono in collisione con qualcosa sopra/sotto evito di accumulare gravità
                movementVelocity.y = 0;
                impulseX           = 0;
            }
        }
    }
    /// <summary>
    /// Funzione che muove i passeggeri
    /// </summary>
    /// <param name="beforeMovePlatform"></param>
    public void MovePassengers(bool beforeMovePlatform)
    {
        for (int i = 0; i < passengerMovement.Count; i++)
        {
            PassengerMovement passenger = passengerMovement[i];

            if (passenger.moveBeforePassenger == beforeMovePlatform)
            {
                PlayerCollisionController collisionCtrl = passenger.transform.GetComponentInParent <PlayerCollisionController>();
                if (collisionCtrl != null)
                {
                    if (!collisionCtrl.GetCollisionInfo().StickyCollision())
                    {
                        collisionCtrl.transform.Translate(collisionCtrl.CheckMovementCollisions(passenger.velocity, passenger.standingOnPlatform));
                    }
                }
                else
                {
                    passenger.transform.Translate(passenger.velocity);
                }
            }
        }
    }