Пример #1
0
    // Use this for initialization
    void Start()
    {
        eg     = GameObject.FindObjectOfType <EventGenerator>();
        em     = GetComponent <EventMove>();
        player = GameObject.FindObjectOfType <PlayerCharacter>();

        //PlayEvent(race, classes, player.money);
    }
Пример #2
0
    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);
    }
Пример #3
0
    public void apiJump()
    {
        EventMove?.Invoke(this.Id, (int)MoveType.jump);

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

        // logic
        StartCoroutine(jump(timeJump));

        audioSourceQuick.PlayOneShot(audioJump);
    }
Пример #4
0
        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));
            }
        }
Пример #5
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}");
            }
        }
Пример #6
0
    // 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);
    }
Пример #7
0
    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));
    }
Пример #8
0
    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);
    }
Пример #9
0
    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();
    }