Esempio n. 1
0
    public void Move(Vector2 posMove)
    {
        int Speed = 10;

        Debug.Log("posMove: " + posMove);
        RigidbodyHero.MovePosition(posMove * Speed);
    }
Esempio n. 2
0
    //FixedUpdate is called at a fixed interval and is independent of frame rate. Put physics code here.
    void FixedUpdate()
    {
        if (Storage.Instance.IsLoadingWorld)
        {
            Debug.Log("_______________ LOADING WORLD ....._______________");
            return;
        }

        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical   = Input.GetAxis("Vertical");

        m_IsHeroMoving = false;
        _movement      = new Vector2(moveHorizontal, moveVertical);
        if (CameraMap.enabled)
        {
            MovementMap(moveHorizontal, moveVertical);
            return;
        }
        else
        {
            //---Move Hero
            RigidbodyHero.MovePosition(RigidbodyHero.position + _movement * Speed * Time.deltaTime);
            if (_movement != new Vector2())
            {
                m_IsHeroMoving = true;
            }
            //--------------
        }
        AnimatorMoveHero();

        if (_movement.x != 0 || _movement.y != 0 || m_isAfterUpdatePosHero)
        {
            if (Storage.Data.UpdatingLocationPersonLocal == 0)
            {
                m_isAfterUpdatePosHero = false;
                Storage.Player.RestructGrid();
            }
            else
            {
                m_isAfterUpdatePosHero = true;
                Debug.Log("_________ Update Position Hero_____________ UpdatingLocationPersonLocal = " + Storage.Data.UpdatingLocationPersonLocal);
            }
        }

        if (Input.GetKey("escape"))
        {
            Storage.EventsUI.PlayerPressEscape();
        }

        if (Input.GetMouseButtonDown(0) && m_IsCursorSelection)
        {
            _MousePositionClick = Input.mousePosition;
        }
        if (Storage.EventsUI.IsCursorVisible)
        {
            _MousePosition = Input.mousePosition;
        }
    }
Esempio n. 3
0
    void Start()
    {
        RigidbodyHero = GetComponent <Rigidbody2D>();

        _count = 0;
        Storage.EventsUI.SetTittle = "";
        Storage.EventsUI.SetCountText(_count);

        //Set Start Position
        RigidbodyHero.MovePosition(new Vector2(40, -40));
        _bilderCursorPosition = new CursorPositionBilder(Storage.Instance.MainCamera);
    }
Esempio n. 4
0
 public void Enable()
 {
     GetComponent <CapsuleCollider2D>().enabled = true;
     RigidbodyHero.WakeUp();
 }
Esempio n. 5
0
 public void Disable()
 {
     GetComponent <CapsuleCollider2D>().enabled = false;
     RigidbodyHero.Sleep();
 }