コード例 #1
0
ファイル: Board.cs プロジェクト: CloudyWater/Peg-Solitare
    //***************************************************************************
    // Function Name:	GetJump
    // Purpose:				Creates a Jump based upon a starting hexagon and an ending
    //								hexagon.
    // Paramaters:		selected	- the starting hexagon.
    //								target		- the ending hexagon.
    // Returns:				retJump		- the resulting Jump.
    //***************************************************************************
    public virtual Jump GetJump(Hexagon selected, Hexagon target)
    {
        Jump retJump         = null;
        int  jumpedXPosition = selected.GetXPosition();
        int  jumpedYPosition = selected.GetYPosition();

        if (selected.GetXPosition() > target.GetXPosition())
        {
            jumpedXPosition = selected.GetXPosition() - 1;
        }
        else if (selected.GetXPosition() < target.GetXPosition())
        {
            jumpedXPosition = selected.GetXPosition() + 1;
        }

        if (selected.GetYPosition() > target.GetYPosition())
        {
            jumpedYPosition = selected.GetYPosition() - 1;
        }
        else if (selected.GetYPosition() < target.GetYPosition())
        {
            jumpedYPosition = selected.GetYPosition() + 1;
        }

        Hexagon jumpedHex = mBoard [jumpedXPosition, jumpedYPosition];

        retJump = new Jump(selected, jumpedHex, target, GameplayUIHandler.GetRemainingTime());

        return(retJump);
    }
コード例 #2
0
    public void RetractMove()
    {
        Jump move = GameDataManager.mSingleton.GetPreviousMove();

        if (move != null)
        {
            move.GetStartHex().EnablePeg(true);
            move.GetJumpedHex().EnablePeg(true);
            move.GetEndHex().EnablePeg(false);

            mRemainingTimeText.text = GameplayUIHandler.FormatRemainingTime(move.GetRemainingTime());
        }
    }
コード例 #3
0
    void Awake()
    {
        CanSpawnHurdle = false;
        PrefsManager.ResetCurrentStats();
        this.Tutorial.SetActive(false);
        this.Player            = GameObject.FindGameObjectWithTag("Player");
        this.PlayerController  = this.Player.GetComponent <BottleTest>();
        this.DumpScenePosition = this.Player.transform.position;
        this.controller        = this.Player.GetComponent <BottleTest>();
        this.targetIndicator   = this.Player.GetComponentInChildren <TargetTest>();
        instance       = this;
        this.uiHandler = GameObject.FindObjectOfType(typeof(GameplayUIHandler)) as GameplayUIHandler;
        this.uiHandler.GameOverPanel.SetActive(false);

        if (PrefsManager.TimesPlayed() < 1)
        {
            this.Tutorial.SetActive(true);
            PrefsManager.IncreaseTimesPlayed();
        }
    }
コード例 #4
0
 private void Awake()
 {
     uiHandler = resultPanel.gameObject.GetComponent <GameplayUIHandler>();
 }