Ejemplo n.º 1
0
    private IEnumerator UpdateShow(float animation_time)
    {
        Transform this_tranform = GetComponent <Transform>();

        ScaleAnimator.StartAnimation(ShowEasingType, this_tranform.localScale, Vector3.one, animation_time);
        yield return(new WaitForSeconds(animation_time));
    }
Ejemplo n.º 2
0
    private IEnumerator UpdateHide(float animation_time)
    {
        Transform this_tranform = GetComponent <Transform>();

        //ScaleAnimator.StartAnimation(EasingFunctions.TYPE.BackInCubic, this_tranform.localScale, Vector3.zero, animation_time);
        ScaleAnimator.StartAnimation(HideEasingType, this_tranform.localScale, Vector3.zero, animation_time);
        yield return(new WaitForSeconds(animation_time));

        gameObject.SetActive(false);
    }
Ejemplo n.º 3
0
 private void Awake()
 {
     Ref             = this;
     trail           = GetComponentInChildren <TrailRenderer>();
     polygonCollider = GetComponent <PolygonCollider2D>();
     circleCollider  = GetComponent <CircleCollider2D>();
     rb                  = GetComponent <Rigidbody2D>();
     scaleAnimator       = GetComponent <ScaleAnimator>();
     shape               = GetComponent <Shape>();
     shape.CirclePercent = TargetCirclePercent;
 }
Ejemplo n.º 4
0
    // .. COROUTINES

    private IEnumerator UpdateClicked(float animation_time)
    {
        onClick.Invoke();

        float     grow_time     = animation_time * 0.5f;
        float     shrink_time   = animation_time * 0.5f;
        Transform this_tranform = GetComponent <Transform>();

        ScaleAnimator.StartAnimation(EasingFunctions.TYPE.BackInCubic, this_tranform.localScale, Vector3.one * BounceFactor, grow_time);
        yield return(new WaitForSeconds(grow_time));

        ScaleAnimator.StartAnimation(EasingFunctions.TYPE.Out, this_tranform.localScale, Vector3.one, shrink_time);
        yield return(new WaitForSeconds(shrink_time));
    }
Ejemplo n.º 5
0
    private bool FallDamage()
    {
        status.TakeDamage(2);

        sound.PlayTakeDamage();

        if (status.CurrentHealth == 0)
        {
            return(true);
        }
        else
        {
            isTakingFallDamage = true;

            ScaleAnimator.GetComponent <Animation>().Play();

            status.EndInvincible();

            return(false);
        }
    }
Ejemplo n.º 6
0
    protected override void LateGlobalSuperUpdate()
    {
        // Trigger any objects we are directly standing on
        if (controller.IsClamping())
        {
            TriggerableObject triggerable = controller.currentGround.Transform.GetComponent <TriggerableObject>();

            if (triggerable != null)
            {
                triggerable.StandingOn(transform.position);
            }
        }

        if (goldMario)
        {
            GoldBodySlam();
        }

        // Increment our position based on our current velocity
        transform.position += moveDirection * controller.deltaTime;

        if (DebugGui)
        {
            DebugDraw.DrawVector(transform.position, lookDirection, 2.0f, 1.0f, Color.red, 0, true);
            DebugDraw.DrawVector(transform.position, input.Current.MoveInput, 1.0f, 1.0f, Color.yellow, 0, true);
            DebugDraw.DrawVector(transform.position, moveDirection, 1.0f, 1.0f, Color.blue, 0, true);
        }

        // Rotate the chest forwards or side to side
        ChestBone.Rotation = Quaternion.Euler(new Vector3(0, chestTwistAngle, chestBendAngle));

        // Angle the controller's mesh based on current art direction
        Vector3 projected = Math3d.ProjectVectorOnPlane(artUpDirection, lookDirection);

        AnimatedMesh.rotation = Quaternion.LookRotation(projected, artUpDirection);

        // End fall damage if the animation has finished playing. If not, scale the
        // animated mesh based on the animation
        if (!ScaleAnimator.GetComponent <Animation>().isPlaying)
        {
            isTakingFallDamage = false;
        }

        if (isTakingFallDamage)
        {
            AnimatedMesh.localScale = new Vector3(AnimatedMesh.localScale.x, ScaleAnimator.localScale.z, AnimatedMesh.localScale.z);
        }
        else
        {
            AnimatedMesh.localScale = new Vector3(1, 1, 1);
        }

        // Check if we have fallen through the level, and place us on the first contacted ground if we have and return Mario to idle
        if (transform.position.y < -10)
        {
            RaycastHit hit;

            Vector3 verticalPostionZeroed = transform.position;
            verticalPostionZeroed.y = 0;

            if (Physics.Raycast(verticalPostionZeroed + Vector3.up * 5000, -Vector3.up, out hit, Mathf.Infinity, controller.Walkable))
            {
                transform.position = hit.point;

                verticalMoveSpeed = 0;
                moveSpeed         = 0;
                moveDirection     = Vector3.zero;

                currentState = MarioStates.Idle;
                return;
            }
        }
    }
Ejemplo n.º 7
0
 private void Awake()
 {
     scaleAnimator = GetComponent <ScaleAnimator>();
     anim          = GetComponent <Animator>();
 }