public static void Main(string[] args) { var board = new Board <ulong>(4, 4, () => 0); var elementGenerator = new RandomCellGenerator <ulong>(element => element == 0); elementGenerator.AddToPool(2, 95); elementGenerator.AddToPool(4, 5); var app = new BoardBehavior <ulong>(board, elementGenerator, new BaseCellBehavior()); app.AddNew(); app.AddUpdatedListener(elements => { app.AddNew(); Render(board); }); Render(board); while (true) { var direction = Input(); if (direction == null) { continue; } var isAlongRow = direction == Direction.Left || direction == Direction.Right; var isIncreasing = direction == Direction.Left || direction == Direction.Up; app.Update(isAlongRow, isIncreasing); } }
void Start() { this.position = -1; this.rotation = -1; this.pieceClass = -1; this.killed = false; this.board = GameObject.Find("Board").GetComponent <BoardBehavior>(); }
public void Collect() { GameObject.Find("Tile_" + this.posX + "_" + this.posY).GetComponent <TileBehavior>().Harvest(); BoardBehavior boardBehavior = GameObject.FindObjectOfType <BoardBehavior>(); boardBehavior.IncrementRessource(this.type); Destroy(gameObject); }
public void BKclick() { Debug.Log("BK Clicked"); GameObject BK = GameObject.Find("Black_King"); BoardBehavior board = GameObject.Find("Board").GetComponent <BoardBehavior>(); board.circleVis(BK.GetComponent <BlackKingInfo>().position); }
public void CreatePrefab() { var go = GameObject.Instantiate(Resources.Load("Board") as GameObject); behavior = go.GetComponent <BoardBehavior>(); behavior.Init(this); LocalPlayerDraw(5); }
public Board(BoardData data, BoardBehavior behavior, BoardNodeFactory nodeFactory) { BoardSize = data.BoardSize; this.nodeFactory = nodeFactory; Behavior = behavior; foreach (var nodeData in data.Nodes) { makeNode(nodeData); } }
void Start() { hud = GameObject.Find("HUD"); // board = GameObject.Find("Board"); Shader shader = GetComponent <Renderer>().material.shader; board = GameObject.Find("Board"); boardBehavior = board.GetComponent <BoardBehavior>(); progressBar = this.transform.Find("ProgressBarCanvas"); this.progressBar.gameObject.SetActive(false); progressBarContent = this.transform.Find("ProgressBarCanvas/progress"); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { BoxCollider temp = gameObject.GetComponent <BoxCollider>(); float half_size_x = transform.localScale.x * (temp.size.x * 0.5f); float half_size_y = transform.localScale.y * (temp.size.y * 0.5f); Debug.Log(Input.mousePosition); if ((float)Input.mousePosition.x >= transform.position.x - half_size_x && (float)Input.mousePosition.x <= transform.position.x + half_size_x && (float)Input.mousePosition.y >= transform.position.y - half_size_y && (float)Input.mousePosition.y <= transform.position.y + half_size_y) { BoardBehavior board = GameObject.Find("Board").GetComponent <BoardBehavior>(); if (board.nowClicked != 18) { Debug.Log("WN2 Clicked"); if (board.nowClicked != -1) { // GameObject piece = GameObject.Find(board.ClasstoStr(board.nowClicked)); board.circleInvis(board.ClasstoPos(board.nowClicked)); Debug.Log("WN2 asdf"); } // board.circleVis(this.position); board.circleVis(board.ClasstoPos(18)); board.nowClicked = 18; //White King : 11 GameObject clockwise_btn = GameObject.Find("Clockwise"); clockwise_btn.GetComponent <SpriteRenderer>().enabled = true; GameObject counterclockwise_btn = GameObject.Find("CounterClockwise"); counterclockwise_btn.GetComponent <SpriteRenderer>().enabled = true; } else { Debug.Log("WN2 Unclick"); // board.circleInvis(this.position); board.circleInvis(board.ClasstoPos(18)); board.nowClicked = -1; //White King : 11 GameObject clockwise_btn = GameObject.Find("Clockwise"); clockwise_btn.GetComponent <SpriteRenderer>().enabled = false; GameObject counterclockwise_btn = GameObject.Find("CounterClockwise"); counterclockwise_btn.GetComponent <SpriteRenderer>().enabled = false; } } temp = null; } }
void Start() { alignLeft = true; boardBehavior = board.GetComponent <BoardBehavior>(); resTimeText = resTime.GetComponent <Text>(); resDirtText = resDirt.GetComponent <Text>(); resClayText = resClay.GetComponent <Text>(); resStickText = resStick.GetComponent <Text>(); resBrickText = resBrick.GetComponent <Text>(); resStoneText = resStone.GetComponent <Text>(); resLeafText = resLeaf.GetComponent <Text>(); resFruitText = resFruit.GetComponent <Text>(); resFoodText = resFood.GetComponent <Text>(); }
public HouseBuilding() { board = GameObject.Find("Board"); boardBehavior = board.GetComponent <BoardBehavior>(); }
// Use this for initialization void Start() { m_HumanType = HUMAN_TYPE.HUMAN_TYPE_NORMAL; // Piece.m_StrongValue=2; // CoreGame = GameObject.Find("coreGame"); BoardClass = CoreGame.GetComponent("BoardBehavior") as BoardBehavior; /// Init the TextUI GameObject go = new GameObject("Text_"+ this.name); UI_StatusText = (GUIText)go.AddComponent( typeof(GUIText) ); UI_StatusText.transform.parent = transform; Font BroadwayFont = (Font)Resources.Load("Fonts/Arial"); UI_StatusText.font = BroadwayFont; UI_StatusText.text = "Init"; UI_StatusText.fontSize=16; // GText.material.color = Color.Green; UI_StatusText.transform.position=new Vector3(0,0,0); TextCoords = new Vector3(0,0,0); /// Status control init m_HumanPiece_Behaviour =m_HumanPiece_Behaviour_Prev = HUMAN_BEHAVIOUR.HUMAN_BEHAVIOUR_IDLE; m_HumanStatus = HUMAN_STATUS.HUMAN_STATUS_INIT; m_nCurrentFrame = 0 ; m_bDistroy = false; UI_StatusText.enabled = ( CoreGame.GetComponent("MainGameWorld") as MainGameWorld).bDebugShowMsg_Creature; }
// Use this for initialization protected void Start() { CoreBoard = (BoardBehavior) GetComponent("BoardBehavior"); progressBar_Base = UIProgressBar.create(buttonToolkit, "UI_Base.png", 0, 0,true,2 ); //progressBar_Science.positionFromBottomLeft( .15f, .02f ); progressBar_Base.positionFromTopLeft( 20f/Screen.height, 960f/Screen.width ); progressBar_Base.resizeTextureOnChange = true; progressBar_Base.value = 1f; // debugString = ""; // Progress/Health bar progressBar_Culture = UIProgressBar.create( buttonToolkit,"UI_Ball.png", 0, 0,false,1 ); //progressBar_Culture = UIProgressBar.create( "UI_Ball.png", 0, 0 ); //progressBar.positionFromLeft //progressBar_Culture.positionFromTopRight( .17f, .40f ); progressBar_Culture.positionFromTopLeft( 30f/Screen.height, 685f/Screen.width); progressBar_Culture.resizeTextureOnChange = true; progressBar_Culture.value = 0.0f; progressBar_Healtth = UIProgressBar.create(buttonToolkit, "UI_Ball.png", 0, 0 ,true,1 ); progressBar_Healtth.positionFromTopLeft(30f/Screen.height, 830f/Screen.width); progressBar_Healtth.resizeTextureOnChange = true; progressBar_Healtth.value = 1.0f; progressBar_Science = UIProgressBar.create(buttonToolkit, "UI_Ball.png", 0, 0,true,1 ); //progressBar_Science.positionFromBottomLeft( .15f, .02f ); progressBar_Science.positionFromTopLeft(30f/Screen.height, 916f/Screen.width ); progressBar_Science.resizeTextureOnChange = true; progressBar_Science.value = 1.0f; //StartCoroutine( animateProgressBar( progressBar_Culture ) ); UIText_Era = new UIText( textToolkit, "prototype", "prototype.png" ); TextUI_ERA = UIText_Era.addTextInstance( m_ERA_NAMEDic[ m_currentERA ], 0, 0 ); //helloText.positionFromTopLeft( 0.1f, 0.05f ); TextUI_ERA.positionFromTopLeft( 0.1f, 0.05f ); }