Пример #1
0
    public bool UpdateBubble(float deltaTime)
    {
        //return GetLuaUpdate(this, deltaTime);
        Vector3 targetVec = _targetMapTilePos - transform.localPosition;
        Vector3 moveVec   = ((targetVec.normalized * DropSpeed) * deltaTime);

        if (moveVec.magnitude >= targetVec.magnitude)
        {
            MapTile nextTile = TargetMapTile.NextTile();
            if (nextTile == null)
            {
                transform.localPosition = _targetMapTilePos;
                return(false);
            }
            else
            {
                transform.localPosition    = _targetMapTilePos + (nextTile.transform.localPosition - _targetMapTilePos).normalized * (moveVec.magnitude - targetVec.magnitude);
                TargetMapTile.TargetBubble = null;
                TargetMapTile         = nextTile;
                nextTile.TargetBubble = this;
                return(true);
            }
        }
        else
        {
            transform.localPosition += moveVec;
        }

        return(true);
    }
Пример #2
0
    public void FindNextTile()
    {
        MapTile nextTile = TargetMapTile.NextTile();

        if (nextTile != null)
        {
            TargetMapTile.TargetBubble = null;
            TargetMapTile         = nextTile;
            nextTile.TargetBubble = this;
        }
    }