Example #1
0
 public override void Launch()
 {
     base.Launch();
     TrailEffect = EffectEmitter.EmitParticle("trail_arrow", Vector3.zero, Vector3.zero, transform);
     Force       = (transform.position - ShootPos).normalized * AmmoSpeed;
     MyRigi.AddForce(Force);
 }
Example #2
0
    private void HandleMovement(float horiz, float verti)
    {
        //Falling from the sky
        if (IsFalling)
        {
            gameObject.layer = 10;
            MyAni.SetBool("Land", true);
        }

        //Dodge on the ground
        if (!Attack && !Roll && (OnGround || airControl) && verti == 0)
        {
            dodgeSpeed      = 100;
            MyRigi.velocity = new Vector2(horiz * speed, MyRigi.velocity.y);
        }

        //Dodge in the sky
        if (Jump && MyRigi.velocity.y == 0)
        {
            dodgeSpeed = .0005f;
            MyRigi.AddForce(new Vector2(0, jumpForce));
        }

        if (verti > 0 && OnGround)
        {
            MyAni.SetBool("LookUp", true);
        }
        else if (verti < 0 && OnGround)
        {
            MyAni.SetBool("LookDown", true);
        }
        else
        {
            MyAni.SetBool("LookUp", false);
            MyAni.SetFloat("Speed", Mathf.Abs(horiz));
            MyAni.SetBool("LookDown", false);
        }
    }