示例#1
0
    bool Shoot(Weapon w)
    {
        if (input.GetDirection() == Vector2.zero)
        {
            bool shot = w.Shoot(target, aimDir);
            if (shot)
            {
                shotCount++;
            }
            if (w.MagSize > 0 && shotCount >= w.MagSize)
            {
                w.IsReloading   = true;
                shotCount       = 0;
                reloadCountdown = w.ReloadTime;

                return(false);
            }
            StartCoroutine(cameraControl.CameraShake(0.1f, 0.2f));

            return(shot);
        }
        else
        {
            return(false);
        }
    }
 void OnTap(GameObject gObj)
 {
     isMoving = input.GetDirection() != Vector2.zero;
     inArea   = hasActiveArea? inArea : true;
     if (inArea && !isMoving && gObj == target)
     {
         OnTriggered();
     }
 }
 void AnimationUpdate()
 {
     dir = input.GetDirection();
     if (dir.magnitude == 0)
     {
         animator.SetBool("isWalking", false);
     }
     else
     {
         animator.SetBool("isWalking", true);
     }
 }
示例#4
0
    public void Update()
    {
        Vector2 direction = input.GetDirection();

        gObj.transform.position += new Vector3(direction.x, direction.y, 0f).normalized *stats.Speed *Time.deltaTime;
    }