示例#1
0
    public void MoveDab(DabController Dab, Vector2 Movement, float Speed)
    {
        if (!Dab.actor.Animator.GetBool(VarDabAnim.Attack) && !Dab.actor.isHurt && !Dab.actor.isKnockDown && Dab.actor.canBeHurt)
        {
            getBodyDab(Dab);
            Body.velocity = new Vector2(Movement.x, 0) * Speed;
        }
        else if (!Dab.actor.isKnockDown)
        {
            Body.velocity = new Vector2(0, 0);
        }

        if (Dab.actor.Animator.GetBool(VarDabAnim.KnockDown))
        {
            if (Dab.Cache.Rotation.z > 270 || Dab.Cache.Rotation.z < 90)
            {
                Body.velocity = new Vector2(-1, 0) * Speed * 1.19f;
            }

            if (Dab.Cache.Rotation.z < 270 && Dab.Cache.Rotation.z > 90)
            {
                Body.velocity = new Vector2(1, 0) * Speed * 1.19f;
            }
        }
    }
示例#2
0
    public override void getAnimation(Actor actor)
    {
        DabController Dab      = GetController(actor);
        float         Rotation = GetController(actor).Cache.Rotation.z;
        Animator      animator = actor.Animator;
        bool          Attack   = animator.GetBool(VarDabAnim.Attack);
        bool          TossTag  = animator.GetCurrentAnimatorStateInfo(0).IsTag(VarDabAnim.Tag_Toss);
        float         cliptime = animator.GetCurrentAnimatorStateInfo(0).normalizedTime;

        if (Dab.CooldownTimer())
        {
            actor.canBeHurt = false;
            if ((Rotation > 270 || Rotation < 90))
            {
                SetAnimator(VarDabAnim.D_Toss, true);
            }

            if (Rotation < 270 && Rotation > 90)
            {
                SetAnimator(VarDabAnim.A_Toss, true);
            }
        }
        else
        {
            SetAnimator(VarDabAnim.D_Toss, false);
            SetAnimator(VarDabAnim.A_Toss, false);
        }

        if (TossTag && cliptime < .9f)
        {
            SetAnimator(VarDabAnim.Toss, true);
            SetAnimator(VarDabAnim.Attack, true);
        }
        if (TossTag && cliptime > .85f)
        {
            actor.canBeHurt = true;
            SetAnimator(VarDabAnim.Attack, false);
        }

        if (!TossTag || (TossTag && cliptime > .9f))
        {
            SetAnimator(VarDabAnim.Toss, false);
        }


        void SetAnimator(string name, bool value)
        {
            animator.SetBool(name, value);
        }
    }
示例#3
0
    public override void getAnimation(Actor actor)
    {
        DabController Dab      = GetController(actor);
        float         Rotation = GetController(actor).Cache.Rotation.z;
        Animator      animator = actor.Animator;
        bool          Attack   = animator.GetBool(VarDabAnim.Attack);
        bool          AK47Tag  = animator.GetCurrentAnimatorStateInfo(0).IsTag(VarDabAnim.Tag_AK47);
        float         cliptime = animator.GetCurrentAnimatorStateInfo(0).normalizedTime;

        if (Dab.Cache.AK47)
        {
            if ((Rotation > 270 || Rotation < 90))
            {
                SetAnimator(VarDabAnim.D_AK47, true);
            }

            if (Rotation < 270 && Rotation > 90)
            {
                SetAnimator(VarDabAnim.A_AK47, true);
            }
        }
        else
        {
            SetAnimator(VarDabAnim.D_AK47, false);
            SetAnimator(VarDabAnim.A_AK47, false);
        }

        if (AK47Tag && cliptime < .9f)
        {
            SetAnimator(VarDabAnim.AK47, true);
            SetAnimator(VarDabAnim.Attack, true);
        }
        if (AK47Tag && cliptime > .8f)
        {
            SetAnimator(VarDabAnim.Attack, false);
        }
        if (!AK47Tag || (AK47Tag && cliptime > .9f))
        {
            SetAnimator(VarDabAnim.AK47, false);
        }


        void SetAnimator(string name, bool value)
        {
            animator.SetBool(name, value);
        }
    }
示例#4
0
 void getBodyDab(DabController dab)
 {
     Body = dab.GetComponent <Rigidbody2D>();
 }
示例#5
0
文件: DabJab.cs 项目: miclede/GameJam
    public override void getAnimation(Actor actor)
    {
        DabController Dab       = GetController(actor);
        float         Rotation  = Dab.Cache.Rotation.z;
        Animator      animator  = actor.Animator;
        bool          Attack    = animator.GetBool(VarDabAnim.Attack);
        bool          hasTarget = GetController(actor).Cache.hasTarget;
        bool          jabTag    = animator.GetCurrentAnimatorStateInfo(0).IsTag(VarDabAnim.Tag_Jab);
        float         cliptime  = animator.GetCurrentAnimatorStateInfo(0).normalizedTime;

        if (hasTarget == true)
        {
            if (Dab.Cache.LeftClick && !Attack)
            {
                if ((Rotation > 270 || Rotation < 90))
                {
                    SetAnimator(VarDabAnim.D_Jab, true);
                }

                if (Rotation < 270 && Rotation > 90)
                {
                    SetAnimator(VarDabAnim.A_Jab, true);
                }
            }

            else if (Dab.Cache.LeftClick && Attack)
            {
                if ((Rotation > 270 || Rotation < 90))
                {
                    if (cliptime > 0.55f)
                    {
                        SetAnimator(VarDabAnim.D_Jab, true);
                    }
                }

                if ((Rotation < 270 && Rotation > 90))
                {
                    if (cliptime > 0.55f)
                    {
                        SetAnimator(VarDabAnim.A_Jab, true);
                    }
                }
            }
            else
            {
                SetAnimator(VarDabAnim.D_Jab, false);
                SetAnimator(VarDabAnim.A_Jab, false);
            }

            if (jabTag && cliptime < .9f)
            {
                SetAnimator(VarDabAnim.Attack, true);
            }
            if (jabTag && cliptime >= .9f)
            {
                SetAnimator(VarDabAnim.Attack, false);
            }
        }

        void SetAnimator(string name, bool value)
        {
            animator.SetBool(name, value);
        }
    }
示例#6
0
 public Vector2 getDabPosititon(DabController dab)
 {
     return(new Vector2(dab.transform.position.x, 0.1f));
 }