Beispiel #1
0
 virtual public void Setup(BoardCursorActualCore c, TweenHandler t, BlockHandler bh, Vector2 nexterPos, bool smallNext, bool show = true, bool touch = false)
 {
     GetPersistData();
     usingTouchControls  = touch;
     topoffset           = 1;
     shiftall            = false; dead = false; cursor = c; deathTile = 3; isShown = show; th = t;
     launchInfo          = new LaunchInfo(-1, 0, deathTile, 0, 1.0f, false);
     countdownFromLaunch = 0; actionDelay = 0;
     changes             = new List <MirrorChange>();
     keyStates           = new int[4] {
         -1, -1, -1, -1
     };
     tileSheet     = GetTileSheet();
     shapeSheet    = GetShapeSheet();
     overlaySprite = GetOverlaySprite();
     bn            = ScriptableObject.CreateInstance <BlockNexter>();
     if (isShown)
     {
         bn.SetupUniversalPrefabAndSheet(PD.universalPrefab, tileSheet, overlaySprite);
     }
     bn.Initialize(bh, nexterPos.x, nexterPos.y, player, isShown, smallNext, ((smallNext || !PD.IsLeftAlignedHUD()) && player == 1) ? 1 : -1);
     SetupTilesList();
     bn.SetupTileGraphics();
     CreateBG();
     chain = 0; misses = 0;
 }
Beispiel #2
0
    public void Start()
    {
        StateControllerInit(false);
        usingTouchControls = PD.GetSaveData().savedOptions["touchcontrols"] == 1;
        firstLaunch        = true;
        player1Human       = !PD.isDemo; player2Human = (PD.gameType == PersistData.GT.Versus);
        bh           = new BlockHandler(PD, PD.GetPuzzleLevel());
        zaps         = new List <ZappyGun>();
        zapsToDelete = new List <ZappyGun>();
        SetupCountdown();
        SetupActors();
        SetupRoundDisplay();
        SetupEasterEgg();
        specialMode = PD.useSpecial;
        height      = PD.isTutorial?6:PD.rowCount; width = 8;
        float p1Xoffset = (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? -10.1f : (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f;

        CreateBoards(p1Xoffset, p2Xoffset);
        SetUpHUDAndScores();
        if (PD.gameType == PersistData.GT.Challenge)
        {
            (board1 as BoardWarPuzzlePlayer).unlockedRow = (hud as PuzzleHUD).GetUnlockedRow();
        }
        cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2);
        cursor2 = CreatePlayerCursor(player2Human || PD.override2P, p2Xoffset, 2, board2, board1, PD.override2P);
        board1.Setup(cursor1, th, bh, (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? new Vector2(-0.2f, -0.6f) : new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), player2Human || (PD.isDemo && PD.demoPlayers == 2), true, player1Human && usingTouchControls);
        board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, player2Human || (PD.isDemo && PD.demoPlayers == 2));
        board1.RefreshGraphics();
        board2.RefreshGraphics();
        CreateMirrors(p1Xoffset, p2Xoffset);
        mirror1.RefreshGraphics();
        mirror2.RefreshGraphics();
        SetupMouseControls(p1Xoffset);

        if (!PD.isDemo)
        {
            if (PD.gameType == PersistData.GT.Campaign)
            {
                campaign = new CampaignHandler(PD, board1 as BoardWarSpecial, board2 as BoardWarCampaign,
                                               mirror2 as BoardMirrorSpecial, cursor1 as BoardCursorWar, cursor2 as BoardCursorBot, hud as CampaignHUD, GetXMLHead());
            }
            pauseButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
            pauseButton      = GetGameObject(player2Human ? (new Vector3(0.0f, -0.1f)):(new Vector3(2.5f, 0.7f)), "Pause Button", pauseButtonSheet[0], true, "HUD");
            pauseButton.SetActive(PD.usingMouse);
            pauseButton.transform.localScale = new Vector3(0.75f, 0.75f);
            FontData f = PD.mostCommonFont.Clone(); f.scale = 0.035f;
            pauseText = GetMeshText(player2Human ? (new Vector3(0.0f, 0.0f)):(new Vector3(2.5f, 0.8f)), GetXmlValue(GetXMLHead(), "pause"), f).gameObject;
            pauseText.SetActive(PD.usingMouse);
            pauseTimer = 0;
            mouseObjects.Add(pauseButton);
            mouseObjects.Add(pauseText);
        }
        else
        {
            demoCountdown = 1800;
        }
    }
Beispiel #3
0
    public OnlinePlayer(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor) : base(mine, theirs, cursor)
    {
        state = 0;
        GameObject Persist = GameObject.Find("PersistData") as GameObject;

        PD          = Persist.GetComponent <PersistData>();
        opponent    = (CSteamID)PD.onlineOpponentId;
        actionQueue = new List <AIAction>();
    }
Beispiel #4
0
 public AICore(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor, int difficulty = 0)
 {
     myBoard    = mine;
     easyMode   = false;
     enemyBoard = theirs;
     c          = cursor;
     confused   = 0;
     setUpDifficulty(difficulty);
     AdditionalSetup();
 }
Beispiel #5
0
    private BoardCursorMirror CreateMirrorCursor(float offset, int player, BoardCursorActualCore parent)
    {
        GameObject        g = GetGameObject(Vector3.zero, "", null, false, "HUDText");
        BoardCursorMirror c = g.AddComponent <BoardCursorMirror>();

        c.SetPD(PD);
        c.xOffset = offset; c.player = player;
        c.setWidthAndHeight(width, height);
        c.Setup(parent, th, PD.gameType != PersistData.GT.Training && PD.gameType != PersistData.GT.Challenge && (player == 2 || player2Human || (PD.isDemo && PD.demoPlayers == 2)));
        return(c);
    }
Beispiel #6
0
    public void Setup(BoardCursorActualCore p, TweenHandler t, bool show = true)
    {
        parent  = p;
        isShown = show;
        th      = t;
        InitializeMembers();
        x    = 4;
        y    = 0;
        maxY = 1.85f - (boardheight - 1) * Consts.TILE_SIZE;

        UpdateMirrorCursorPos(true);
        FinishUpdate();
    }
Beispiel #7
0
	public override void Setup(BoardCursorActualCore c, TweenHandler t, BlockHandler b, Vector2 nexterPos, bool smallNext, bool show = true, bool touch = false) {
		deathTile = 7; // might be useless
		base.Setup(c, t, b, nexterPos, smallNext, show, touch);
		topoffset = 2;
		cursor.setWidthAndHeight(width, ++height);
		for (int x = 0; x < width; x++) { tiles.Add(CreateTile(x, height - 1, 4)); }
		shields = new List<Shield>();
		shieldSheet = Resources.LoadAll<Sprite>(SpritePaths.Shield);
		eyeSheet = Resources.LoadAll<Sprite>(PD.IsScopophobic()?SpritePaths.EyeSheetScopo:SpritePaths.EyeSheet);
		gold = 0; eyeballTimer = 0;
		justGotAShield = false;
		frozen = false;
	}
Beispiel #8
0
 override public void Setup(BoardCursorActualCore c, TweenHandler t, BlockHandler bh, Vector2 nexterPos, bool smallNext, bool show = true, bool touch = false)
 {
     base.Setup(c, t, bh, nexterPos, smallNext, show, touch);
     topoffset = 1;
     cursor.setWidthAndHeight(width, --height);
 }
 public TrainingAI(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor) : base(mine, theirs, cursor)
 {
     state = 0;
 }
Beispiel #10
0
    public void DoUpdate(BoardCursorActualCore c, BoardCursorActualCore c2)
    {
        switch (tutState)
        {
        case -1:
            if (--negativeonetimer == 0)
            {
                newState();
            }
            break;

        case 0:
            if (c.getX() == 4 && c.getY() == 5)
            {
                Destroy(highlight); newState();
            }
            break;

        case 1:
            if (bo1.GetValueAtXY(4, 5).GetColorVal() == 1)
            {
                newState();
            }
            break;

        case 2:
            if (bo1.GetValueAtXY(4, 5).GetColorVal() == 1 && bo1.GetValueAtXY(4, 4).GetColorVal() == 1)
            {
                newState();
            }
            break;

        case 3:
            if (bo1.launchInfo.launching)
            {
                newState();
            }
            break;

        case 4:
            if (bo2.GetHighestYAtX(3) == 3)
            {
                newState();
            }
            break;

        case 5:
            if (bo2.GetHighestYAtX(3) == 2)
            {
                newState();
            }
            break;

        case 6:
            if (bo1.GetValueAtXY(4, 5).GetColorVal() == 1 && bo1.GetValueAtXY(4, 4).GetColorVal() == 1)
            {
                newState();
            }
            break;

        case 7:
            if (bo1.GetValueAtXY(4, 5).GetColorVal() == 1 && bo1.GetValueAtXY(4, 4).GetColorVal() == 1 && bo1.GetValueAtXY(4, 3).GetColorVal() == 1)
            {
                newState();
            }
            break;

        case 8:
            if (bo1.GetValueAtXY(4, 5).GetColorVal() == 1 && bo1.GetValueAtXY(4, 4).GetColorVal() == 1 && bo1.GetValueAtXY(4, 3).GetColorVal() == 1 && bo1.GetValueAtXY(4, 2).GetColorVal() == 1 && bo1.GetValueAtXY(4, 1).GetColorVal() == 1)
            {
                newState();
            }
            break;

        case 9:
            if (bo1.GetValueAtXY(4, 5).GetColorVal() == 1 && bo1.GetValueAtXY(4, 4).GetColorVal() == 1 && bo1.GetValueAtXY(4, 3).GetColorVal() == 1 && bo1.GetValueAtXY(4, 2).GetColorVal() == 1 && bo1.GetValueAtXY(4, 1).GetColorVal() == 1 && bo1.GetValueAtXY(4, 0).GetColorVal() == 1)
            {
                newState();
            }
            break;

        case 10:
            if (bo2.GetHighestYAtX(3) < 0)
            {
                newState();
            }
            break;

        case 11:
            if (bo1.GetValueAtXY(4, 5).GetColorVal() == bo1.GetValueAtXY(4, 4).GetColorVal() && bo1.GetValueAtXY(4, 3).GetColorVal() == bo1.GetValueAtXY(4, 4).GetColorVal())
            {
                ForceCursor2ToShift(c2, 1); newState();
            }
            break;

        case 12:
            if (bo2.GetHighestYAtX(3) < 0)
            {
                ForceCursor2ToShift(c2, 2); newState();
            }
            break;

        case 13:
            if (bo1.GetValueAtXY(3, 5).GetColorVal() == bo1.GetValueAtXY(3, 4).GetColorVal() && bo1.GetValueAtXY(3, 3).GetColorVal() == bo1.GetValueAtXY(3, 4).GetColorVal())
            {
                newState();
            }
            break;

        case 14:
            if (bo1.launchInfo.launching)
            {
                newState();
            }
            break;

        case 15:
            bo2.BeDefeated(); tutState++;
            break;
        }
    }
Beispiel #11
0
 private void ForceCursor2ToShift(BoardCursorActualCore c, int i)
 {
     (c as BoardCursorBot).forceAIState(i);
 }
Beispiel #12
0
 public AIversion2(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor, int difficulty = 0) : base(mine, theirs, cursor, difficulty)
 {
 }