Exemplo n.º 1
0
    private void ActionCompleteEffect()
    {
        Vector3 effectPosition1 = BoundUtils.GetMinMaxFromBoundVector(moveVector, myCollider.bounds, true, +0.2F);

        effectPosition1 += Vector3.down * Utils.PixelToWorldunits(4);
        Vector3 effectPosition2 = BoundUtils.GetMinMaxFromBoundVector(moveVector, myCollider.bounds, false, -0.2F);

        effectPosition2 += Vector3.down * Utils.PixelToWorldunits(4);
        InstantiateEffect(dustEffect, effectPosition1, BoundUtils.GetEffectRotation(moveVector, false));
        InstantiateEffect(dustEffect, effectPosition2, BoundUtils.GetEffectRotation(moveVector, false));

        actionCompleteEffectPlayed = true;
    }
    public override void ReactToPassenger(Vector3 velocity, PassengerMovement passenger)
    {
        bool    squisch           = false;
        Vector3 hitSourcePosition = transform.position;

        if ((!passenger.standingOnPlatform && velocity.x < 0 && passengerDictionary[passenger.transform].IsLeft()) ||
            (!passenger.standingOnPlatform && velocity.x > 0 && passengerDictionary[passenger.transform].IsRight()))
        {
            // sideways squisch!
            squisch           = true;
            hitSourcePosition = new Vector3(transform.position.x, passenger.transform.position.y, transform.position.z);
        }

        if ((passenger.standingOnPlatform && velocity.y > 0 && passengerDictionary[passenger.transform].IsBelow() && passengerDictionary[passenger.transform].IsAbove()) ||
            (!passenger.standingOnPlatform && passengerDictionary[passenger.transform].IsBelow() && velocity.y < 0))
        {
            // vertical squisch!
            squisch           = true;
            hitSourcePosition = new Vector3(passenger.transform.position.x, transform.position.y, transform.position.z);
        }

        if (squisch)
        {
            HurtBox hurtBox = passenger.transform.GetComponent <HurtBox>();
            if (!hurtBox)
            {
                hurtBox = passenger.transform.GetComponentInChildren <HurtBox>();
            }

            if (hurtBox)
            {
                hurtBox.ReceiveHit(true, 100, HitBox.DAMAGE_TYPE.SQUISH, hitSourcePosition);

                // create squish effect on platform
                Vector3 positionEffectPlatform = BoundUtils.GetPositionOnBounds(velocity, passenger.transform.position, myCollider.bounds, 26);
                InstantiateEffect(squishEffect, positionEffectPlatform, BoundUtils.GetEffectRotation(velocity, true), transform);

                // create squish effect on ground
                BoxCollider2D collider2D = passenger.transform.GetComponent <BoxCollider2D>();
                if (collider2D)
                {
                    Vector3 positionEffectGround = BoundUtils.GetPositionOnBounds(velocity, positionEffectPlatform, collider2D.bounds);
                    InstantiateEffect(squishEffect, positionEffectGround, BoundUtils.GetEffectRotation(velocity, false));
                }
            }
        }
    }
    private void ActionCompleteEffect()
    {
        if (shakeCam)
        {
            CameraFollow.GetInstance().ShakeSmall();
        }
        Vector3 effectPosition1 = BoundUtils.GetMinMaxFromBoundVector(moveVector, myCollider.bounds, true, +0.2F);
        Vector3 effectPosition2 = BoundUtils.GetMinMaxFromBoundVector(moveVector, myCollider.bounds, false, -0.2F);

        InstantiateEffect(dustEffect, effectPosition1, BoundUtils.GetEffectRotation(moveVector, false));
        InstantiateEffect(dustEffect, effectPosition2, BoundUtils.GetEffectRotation(moveVector, false));

        if (moveVector.y > 0 || moveVector.x != 0)
        {
            Vector3 dustEffectPosition1 = BoundUtils.GetMinMaxFromBoundVector(moveVector, myCollider.bounds, false, +0.2F);
            InstantiateEffect(dustDownEffect, dustEffectPosition1);
            if (moveVector.y > 0)
            {
                Vector3 dustEffectPosition2 = BoundUtils.GetMinMaxFromBoundVector(moveVector, myCollider.bounds, true, +0.2F);
                InstantiateEffect(dustDownEffect, dustEffectPosition2);
            }
        }
    }