예제 #1
0
    // move within arena boundaries given 'directional' vector (non-unit: x is -1 OR 1 and y is -1 OR 1)
    public virtual void Move(Vector2 dir)
    {
        Vector2 soulDir = soul.GetMovement(dir.x, dir.y);

        soulDir *= Time.deltaTime;

        // reusing the direction Vector2 for position to save ourselves the creation of a new object
        float oldXPos = self.anchoredPosition.x;
        float oldYPos = self.anchoredPosition.y;

        ModifyPosition(soulDir.x, soulDir.y, false);
        MovementDelta(oldXPos, oldYPos);
    }
예제 #2
0
    // move within arena boundaries given 'directional' vector (non-unit: x is -1 OR 1 and y is -1 OR 1)
    public virtual void Move(Vector2 dir)
    {
        Vector2 soulDir = soul.GetMovement(dir.x, dir.y);

        if (ControlPanel.instance.FrameBasedMovement)
        {
            soulDir *= 1.0f / 60.0f;
        }
        else
        {
            soulDir *= Time.deltaTime;
        }
        lastMovement = soulDir;

        // reusing the direction Vector2 for position to save ourselves the creation of a new object
        float oldXPos = self.anchoredPosition.x, oldYPos = self.anchoredPosition.y;

        ModifyPosition(soulDir.x, soulDir.y, false);
        MovementDelta(oldXPos, oldYPos);
    }