public void apiIdle()
    {
        EventMove?.Invoke(this.Id, (int)MoveType.idle,
                          new Vector2(gameObject.transform.position.x, gameObject.transform.position.y));

        movement.x = 0;
        // updateVelocity();
        // SetMovement("x", 0);
    }
    public void apiJump()
    {
        EventMove?.Invoke(this.Id, (int)MoveType.jump);

        // show animation
        countJump++;
        countJumpTemp++;

        // logic
        StartCoroutine(jump(timeJump));

        audioSourceQuick.PlayOneShot(audioJump);
    }
        public void OnMouseMove(InputAction.CallbackContext context)
        {
            if (context.performed)
            {
                _data.SetScreenPosition(context.ReadValue <Vector2>());

                if (_data.clicked)
                {
                    EventDrag?.Invoke(this, new MouseInfoEventArgs(_data));
                }

                EventMove?.Invoke(this, new MouseInfoEventArgs(_data));
            }
        }
示例#4
0
        public void MoveFilesToArh(object arhiv)
        {
            foreach (var fileToMove in GetFilesToMoveToArh((Arhiv)arhiv))
            {
                //перемещаем файл
                File.Move(((Arhiv)arhiv).FromDirectory + fileToMove,
                          ((Arhiv)arhiv).ToDirectory + fileToMove);

                //отправляем информацию о перемещенном файле подписчикам
                EventMove?.Invoke($"{DateTime.Now} " +
                                  $"Файл {((Arhiv)arhiv).FromDirectory}{fileToMove} " +
                                  $"перемещен в папку {((Arhiv)arhiv).ToDirectory}{fileToMove}");
            }
        }
    // api for AutoMoveAttack
    public void apiGoRight(bool isRight = true)
    {
        // print("MyCharacterController.cs: api go right");
        EventMove?.Invoke(this.Id, (int)MoveType.walk * (isRight ? 1 : -1));


        if (isRight)
        {
            movement.x = 1;
        }
        else
        {
            movement.x = -1;
        }

        // print("MyCharacterController.cs: " + gameObject.name + " , " + isRight);
    }
    public void apiDie()
    {
        var hp = gameObject.GetComponent <HP>();

        if (hp.currentHealth > 0)
        {
            hp.ChangeHealth(-100);
            return;
        }

        EventMove?.Invoke(this.Id, (int)MoveType.die);

        // show anim
        isDie = true;

        // wait some seconds then destroy
        StartCoroutine(waitThenDestroy(timeShowDealth));
    }
    public void apiAttack()
    {
        EventMove?.Invoke(this.Id, (int)MoveType.attack);

        print("MyCharacterController.cs: herer attack: " + isAttack);
        if (isAttack || currentAvailableAttack <= 0)
        {
            return;
        }

        // wait delay then start attack
        isAttack = true;
        currentAvailableAttack--;
        StartCoroutine(attack(timeAttackDelay));

        // handle attack collide and attack done in handler

        audioSourceQuick.PlayOneShot(audioAttack);
    }
    public void apiUlti()
    {
        EventMove?.Invoke(this.Id, (int)MoveType.ulti);

        if (isUlti || !ultiController.CanUlti())
        {
            return;
        }

        // if allow move, so no need to show animation and block movement
        if (ultiController.canMoveWhenUlti)
        {
            ultiController.Fire();
            return;
        }

        // flag to show animation
        isUlti = true;

        // logic
        StartCoroutine(ulti(ultiController.utliDurationTime));
        // ultiController.Fire();
    }