Example #1
0
    public bool moveToDirection(int x, int y, bool start, bool follow, int speed, OnEventOver over)
    {
        if (x == posX && y == posY)
        {
            return(false);
        }

        if (startMoving)
        {
            return(false);
        }

        moveSpeed = GameDefine.getMoveSpeed(speed);

        sceneFollow        = follow;
        playStartAnimation = start;
        onEventOver        = over;

        moveBuffer.Clear();

        moveToX = x;
        moveToY = y;

        moveToBattleX = GameDefine.getBattleX(x);
        moveToBattleY = GameDefine.getBattleY(y);

        startAnimation();

        startMoving = true;

        return(true);
    }
Example #2
0
    public void moveToBattlePos()
    {
        posBattleX = GameDefine.getBattleX(posX);
        posBattleY = GameDefine.getBattleY(posY);

        updatePosition();
    }
Example #3
0
    public void moveTo(int x, int y, int sx, int sy, bool follow, OnEventOver over, bool delay = false)
    {
#if UNITY_EDITOR
        Debug.Log("GameBattleCursor moveTo " + x + " " + y);
#endif

        moveToX = x;
        moveToY = y;

        moveToXReal = GameDefine.getBattleX(x);
        moveToYReal = GameDefine.getBattleY(y);

        posXSpeed = sx;
        posYSpeed = sy;

        isMoving = true;

        isFollow = follow;

        onEventOver = over;

        if (delay && posX == x && posY == y)
        {
            time = -0.5f;
        }
        else
        {
            time = 0.0f;
        }
    }
Example #4
0
    public void moveNext()
    {
        moveToX = moveBuffer[1];
        moveToY = moveBuffer[0];

        moveToBattleX = GameDefine.getBattleX(moveBuffer[1]);
        moveToBattleY = GameDefine.getBattleY(moveBuffer[0]);

        moveBuffer.RemoveRange(0, 2);
    }
Example #5
0
    public void moveTo(int x, int y, bool follow)
    {
        posX = x;
        posY = y;

        posXReal = GameDefine.getBattleX(x);
        posYReal = GameDefine.getBattleY(y);

        time = 0.0f;

        isFollow = follow;

        updatePosition();
    }
    public void addCell(int x, int y, GameUnitCampType camp)
    {
        GameObject obj = Instantiate(Resources.Load <GameObject>("Prefab/Cell"), transform);

        obj.name = x + "-" + y;

        Transform trans = obj.transform;

        trans.localPosition = new Vector3(GameDefine.getBattleX(x),
                                          GameDefine.getBattleY(y) + GameBattleManager.instance.LayerHeight,
                                          0.0f);

        SpriteRenderer sprite = obj.GetComponent <SpriteRenderer>();
        Color          c      = camp == GameUnitCampType.User ? new Color(1.0f, 0.0f, 1.0f, 0.5f) : new Color(1.0f, 0.0f, 0.0f, 0.5f);

        sprite.color = c;
    }
Example #7
0
    public void addCell(Cell cell, bool user)
    {
        GameObject obj = Instantiate(Resources.Load <GameObject>("Prefab/Cell"), transform);

        obj.name = cell.x + "-" + cell.y;

        Transform trans = obj.transform;

        trans.localPosition = new Vector3(GameDefine.getBattleX(cell.x),
                                          GameDefine.getBattleY(cell.y) + GameBattleManager.instance.LayerHeight,
                                          0.0f);

        SpriteRenderer sprite = obj.GetComponent <SpriteRenderer>();
        Color          c      = user ? new Color(1.0f, 0.0f, 1.0f, 0.5f) : new Color(1.0f, 0.0f, 0.0f, 0.5f);

        sprite.color = c;

#if UNITY_EDITOR
        CellTest test = obj.AddComponent <CellTest>();
        test.c = cell.c;
        test.f = cell.f;
#endif
    }