void BindFields() { var fields = FieldController.GetFieldsTable(ModuleContext.ModuleId); var rowCount = fields.Rows.Count; grdFields.DataSource = fields.DefaultView; grdFields.DataBind(); grdFields.Visible = Convert.ToBoolean(rowCount != 0); cmdAddField.NavigateUrl = EditUrl(-1); }
protected virtual void Field_OnClicked(FieldController InField) { if (State == GameState.RedPlayerMoves || State == GameState.WhitePlayerMoves) { // If the field on which we clicked is one of possible target fields if (PossibleMoves != null && PossibleMoves.IsMovePossible(InField)) { PossibleMoves.MoveTo(InField); } } }
private void Start() { GameObject ChessTable = GameObject.Find("chess-table"); Controller = ChessTable.GetComponent <FieldController>(); ChessTable = GameObject.Find("chess-table"); GameObject ScriptHolder = GameObject.Find("ScriptHolder"); AiDetails = ScriptHolder.GetComponent <AIDetails>(); StepRandomizer = Random.Range(2, 20); }
//----------------------------------------------------------------------------------- public void CheckBodiesForChanges(bool recreateIfInvalid) { GameObject[] arrGameObject = FieldController.GetUnityGameObjects(); foreach (GameObject go in arrGameObject) { if (go != null) { ActionCheckBodyForChanges(go, recreateIfInvalid); } } }
private void OnTriggerExit2D(Collider2D collision) { ColliderController colliderController = collision.gameObject.GetComponent <ColliderController>(); FieldController FC = GetComponentInParent <FieldController>(); if ((colliderController.Type == ColliderController.ColliderType.FieldBuildCollider || colliderController.Type == ColliderController.ColliderType.TurretBuildCollider) && !FC.IsBuilding) { CanBuild(false, colliderController, collision); } }
void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } //DontDestroyOnLoad(gameObject); }
public FieldEditor(FieldController node) { InitializeComponent(); target = node; this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.mouseMove); this.MouseLeave += new System.EventHandler(this.mouseLeave); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.mouseDown); this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.mouseUp); this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.mouseWheel); this.Paint += new System.Windows.Forms.PaintEventHandler(this.draw); }
public bool IsMovePossible(FieldController InField) { foreach (Move move in Moves) { if (move.GetDestination() == InField) { return(true); } } return(false); }
void Validation() { if(model==null) { model = this.GetComponent<TileModel>(); if(model==null) { model = gameObject.AddComponent<TileModel>(); } } if(fieldController==null) { fieldController = this.transform.parent.GetComponent<FieldController>(); } }
private void Awake() { Field = new FieldController(); m_food = new FoodController(Field); Snakes = new SnakeController(Field); m_camMove = Camera.main.GetComponent <CameraMovement>(); m_canvas = FindObjectOfType <UICanvas>(); }
//---------------------------------------------------------------------------------- public void CheckUpdate(out int[] idsUnityAdded, out int[] idsUnityRemoved) { bool updateNeeded = FieldController.IsUpdateNeeded(out idsUnityAdded, out idsUnityRemoved); if (updateNeeded) { if (Data != null) { Data.NeedsUpdate = true; EditorUtility.SetDirty(Data); } } }
public virtual void SetParent(PawnsContainer InContainer) { if (InContainer != null) { transform.parent = InContainer.transform; Container = InContainer; Field = Container as FieldController; } else { // error } }
public void MoveTo(FieldController InDestination) { // Getting the move that we'll be doing int moveIndex = -1; Move move = FindMove(InDestination, ref moveIndex); if (move != null && move.IsValid()) { move.DoMove(); } Clear(); }
private void setSelf() { if (FC == null) { FC = this; DontDestroyOnLoad(this); DontDestroyOnLoad(canvas); } if (FC != this) { Destroy(this.gameObject); } }
/// <summary> /// Fire this instance. /// </summary> public virtual void Fire() { if (FieldController != null) { Vector2 offset1, offset2, location; offset1 = offset2 = shotOffset; offset2.x *= -1; location = Util.To2D(Transform.position); Projectile shot1 = FieldController.SpawnProjectile(shotType, location + offset1, 0f, PlayerFieldController.CoordinateSystem.AbsoluteWorld); Projectile shot2 = FieldController.SpawnProjectile(shotType, location + offset2, 0f, PlayerFieldController.CoordinateSystem.AbsoluteWorld); shot1.Velocity = shot2.Velocity = shotVelocity; } }
public Bullet(Color col) { m_color = col; m_timeSpan = GameManager.BULLET_TIME_SPAN; Go = GameObject.Instantiate(Resources.Load <GameObject>("Bullet")); SetColor(); m_field = GameManager.Instance.Field; IsAlive = true; }
private void GetEmptyBlock(FieldController field, FieldBlockType line, ref FieldBlock block) { List <FieldBlock> blocks = field.GetBlocksOfLine(line); foreach (FieldBlock b in blocks) { if (b.m_Unit == null) { block = b; return; } } block = null; }
private void Awake() { _fieldContrcoller = new FieldController(_fieldConfig, _fieldView); _playerController = new PlayerController(_playerConfig, _playerView); _guardController = new GuardController(_guardConfig, _guardView); _guardVisionSystem = new GuardVisionSystem(); _userInputSystem = new UserInputSystem(); _gameLoopController = new GameLoopController(_gameLoop); }
private bool CheckContraints(FieldController controller) { try { controller.CheckConstraints(); } catch (FieldException exc) { NotificationHelper.ShowNotification("Error", exc.CustomMessage); return(false); } return(true); }
protected Move FindMove(FieldController InDestination, ref int OutMoveIndex) { for (int iMove = 0; iMove < Moves.Count; ++iMove) { if (Moves[iMove].GetDestination() == InDestination) { OutMoveIndex = iMove; return(Moves[iMove]); } } OutMoveIndex = -1; return(null); }
//----------------------------------------------------------------------------------- public override void Init() { base.Init(); CNFieldContentType allowedTypes = CNFieldContentType.Geometry | CNFieldContentType.BodyNode; FieldController.SetFieldContentType(allowedTypes); FieldController.IsBodyField = true; FieldControllerLocators = new CNFieldController(Data, Data.Locators, eManager, goManager); FieldControllerLocators.SetFieldContentType(CNFieldContentType.Locator | CNFieldContentType.Geometry); FieldControllerLocators.SetCalculatesDiff(true); }
//----------------------------------------------------------------------------------- public void SetResponsiveness(bool responsive) { if (Data.IsFiniteMass != responsive) { Data.IsFiniteMass = responsive; if (!Data.IsNodeExcludedInHierarchy) { GameObject[] arrGameObject = FieldController.GetUnityGameObjects(); eManager.SetResponsiveness(Data, arrGameObject); } EditorUtility.SetDirty(Data); } }
//----------------------------------------------------------------------------------- public virtual void CreateBodies() { if (!IsExcludedInHierarchy) { GameObject[] gameObjects = FieldController.GetUnityGameObjects(); CreateBodies(gameObjects); LoadState(); } if (Data != null) { Data.NeedsUpdate = false; EditorUtility.SetDirty(Data); } }
public void UIEndTurn() { if (GameManager.Get().turnPlayer == playerId) { if (GameManager.Get().effectInProgess) { return; } if (FieldController.GetFieldController().cardSelected != -1) { FieldController.GetFieldController().SelectCard(FieldController.GetFieldController().cardSelected); } GameManager.Get().NetRPC("EndTurn", RPCMode.Server, playerId); } }
void Start() { posX = this.transform.position.x; posY = this.transform.position.y; hp = 100; attackDamage = 20; spellRadius = 10f; attackCoolDown = 1.5f; lastAttackTime = Time.time; animator = GetComponent <Animator> (); // find field controller fieldController = GameObject.FindGameObjectWithTag("FieldController").GetComponent <FieldController> (); monsterList = fieldController.monsterList; }
IEnumerator WaitForLevelInit() { while (Level.Instance == null) { yield return(null); } GameObject go = Instantiate(Level.Instance.generatorPrefab); go.transform.parent = transform; go.transform.localPosition = new Vector3(0.5f, 0, -0.5f); Debug.Log("Generator created"); field = GetComponentInChildren <FieldController>(); field.Radius = 0; }
private void CalculateStatistics() { GameObject[] goToChop = FieldController.GetUnityGameObjects(); int nInputObjects = 0; int inputVertices = 0; int inputIndices = 0; int nOutputPieces = 0; int outputVertices = 0; int outputIndices = 0; for (int i = 0; i < goToChop.Length; i++) { GameObject go = goToChop[i]; Mesh mesh = go.GetMesh(); if (mesh != null) { nInputObjects++; inputVertices += mesh.vertexCount; inputIndices += mesh.triangles.Length; } } Data.InputObjects = nInputObjects; Data.InputVertices = inputVertices; Data.InputTriangles = inputIndices / 3; GameObject[] arrGOChopped = Data.ArrChoppedGameObject; for (int i = 0; i < arrGOChopped.Length; i++) { GameObject go = arrGOChopped[i]; Mesh mesh = go.GetMesh(); if (mesh != null) { nOutputPieces++; outputVertices += mesh.vertexCount; outputIndices += mesh.triangles.Length; } } Data.OutputPieces = nOutputPieces; Data.OutputVertices = outputVertices; Data.OutputTriangles = outputIndices / 3; }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.T) && Time.timeScale != 0) { StateText3D.text = ""; GameObject ChessTable = GameObject.Find("chess-table"); FieldController fc = ChessTable.GetComponent <FieldController>(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { StateText3D.text += fc.Table[i, j].ToString() + " "; } StateText3D.text += '\n'; } } }
private void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; } if (highlightFxObject == null) { highlightFxObject = Instantiate(prefabHighlight); highlightFxObject.SetActive(false); } }
bool IsUniqueFieldTitle(string fieldTitle, string oldfieldtitle) { oldfieldtitle = oldfieldtitle.ToLowerInvariant(); var fields = FieldController.GetFieldsTable(ModuleContext.ModuleId); var isUnique = !fields.Rows.Cast <DataRow>() .Any( field => field[FieldsTableColumn.Title].ToString().ToLowerInvariant() == fieldTitle.ToLowerInvariant() && field[FieldsTableColumn.Title].ToString().ToLowerInvariant() != oldfieldtitle); if (!isUnique) { throw new FieldTitelException(LocalizeString("UniqueFieldName.ErrorMessage")); } return(true); }
void Start() { GameObject cansField = GameObject.Find("Health Field"); if (cansField != null) { cansFieldCtrl = cansField.GetComponent <FieldController> (); cansFieldCtrl.SetValue(currentHealth); } GameObject roundsField = GameObject.Find("Level Field"); if (roundsField != null) { roundsFieldCtrl = roundsField.GetComponent <FieldController> (); roundsFieldCtrl.SetValue(currentLevel); } }
void Start() { posX = this.transform.position.x; posY = this.transform.position.y; hp = 50; // find field controller fieldController = GameObject.FindGameObjectWithTag("FieldController").GetComponent<FieldController> (); // find hero hero = GameObject.FindGameObjectWithTag("Hero").GetComponent<Hero> (); moveTarget = new Vector3 (hero.posX, posY, 0); moveDistance = this.transform.position.x - moveTarget.x; moveSpeed = 0.1f; moveDuration = moveDistance / moveSpeed; attackCoolDown = 2f; lastAttackTime = Time.time; animator = GetComponent<Animator> (); }
public void Awake() { playerId = GameManager.Get().localPlayerId; fCtrl = FieldController.GetFieldController(); }
void Start() { posX = this.transform.position.x; posY = this.transform.position.y; hp = 100; attackDamage = 20; spellRadius = 10f; attackCoolDown = 1.5f; lastAttackTime = Time.time; animator = GetComponent<Animator> (); // find field controller fieldController = GameObject.FindGameObjectWithTag("FieldController").GetComponent<FieldController> (); monsterList = fieldController.monsterList; }
private void OnEnable() { _fieldController = GetComponent<FieldController>(); }
private void Awake() { Instance = this; var box = gameObject.AddComponent<BoxCollider>(); box.isTrigger = true; var boxSize = box.size; boxSize.x = Size.x; box.size = boxSize; var boxCenter = box.center; boxCenter.x = Size.x / 2 - 0.5f; boxCenter.y = -1f; box.center = boxCenter; _field = new GameObject[(int)Size.x, (int)Size.y]; if (Level == 0) Level = 1; }
public void SetController(FieldController fieldController) { this.fieldController = fieldController; }