public void Save(DirectionControl directionControl, List <int> p_id) { int u = 0; if (directionControl != null) { while (u < directionControl.ListBox.Items.Count) { MySqlCommand command = new MySqlCommand( "INSERT INTO cart (user_id, position, prof_id)" + " VALUES (1, @p, @j)", connection ); command.Parameters.Add("@p", MySqlDbType.Int16).Value = u; command.Parameters.Add("@j", MySqlDbType.Int16).Value = p_id[u]; MySqlDataReader reader = command.ExecuteReader(); reader.Close(); u++; } } }
private void OnCopySettings(object data) { GameObject gameObject = (GameObject)data; DirectionControl component = gameObject.GetComponent <DirectionControl>(); SetAllowedDirection(component.allowedDirection); }
void AddToCart(Direction direction) { profile_repository.clearCartbd(); var profiles = profilesByDirectionId[direction.Id]; DirectionControl directionControl = new DirectionControl(direction, profiles); cart.Controls.Add(directionControl); List <int> p_id = directionControl.p_id; directionControl.Cursor = Cursors.Default; directionControl.CloseControl.Click += (s, e) => { profile_repository.clearCartbd(); cart.Controls.Remove(directionControl); directionControl = null; saveButton.Enabled = true; }; saveButton.Click += (s, e) => { profile_repository.Save(directionControl, p_id); saveButton.Enabled = false; }; }
public void SelectPointButton(int PosisitionPointindex) { PosisitionPoints = PositionPoint[PosisitionPointindex].transform.position; if (ManagerCharSelectLogic.ManagerTurnController.stateID == TurnBaseController.states.StrategyMode) { ManagerDirectionControl = ManagerTurnControl.PlayerManager[0].GetComponent <CharacterSelectLogic>().transform.GetChild((int)ManagerTurnControl.PlayerManager[0].GetComponent <CharacterSelectLogic>().currentChar).GetComponent <DirectionControl>(); ManagerDirectionControl.AssignDeffense(); // ManagerDirectionControl.AssignDeffense(); } else if (ManagerCharSelectLogic.ManagerTurnController.stateID == TurnBaseController.states.Attacker) { if (ManagerTurnControl.AttackFirstPos[(int)ManagerCharSelectLogic.currentChar] == true) { return; } /* * if (PosisitionPointindex == 6 || PosisitionPointindex == 7 || PosisitionPointindex == 8) * { * * } */ ManagerTurnControl.PlayerManager[1].GetComponent <CharacterSelectLogic>().transform.GetChild((int)ManagerTurnControl.PlayerManager[0].GetComponent <CharacterSelectLogic>().currentChar).GetComponent <DirectionControl>().AssignAttacker(); // ManagerDirectionControl.AssignAttacker(); } }
/// <summary> /// Initializing Constructor for Dynamic Objects /// </summary> private void Initialize() { turnController = FindObjectOfType <TurnBaseController>(); ManagerCharSelectLogic = GetComponentInParent <CharacterSelectLogic>(); // tambah efath ManagerPointManager = FindObjectOfType <PointManager>(); ManagerStrategyUI = FindObjectOfType <StrategyModeUI>(); dir = this.gameObject.GetComponent <DirectionControl>(); }
public WhenNavigating() { var logger = new NullLoggerFactory().CreateLogger("Logger"); var directionControl = new DirectionControl(); var movementControl = new MovementControl(); _navigationControl = new NavigationControl(movementControl, directionControl, logger); }
public void Forma() { List <Direction> directions = direction_repository.GetAll(); List <Profile> profiles = profile_repository.GetAll(); directionsById = new Dictionary <int, Direction>(); profilesByDirectionId = new Dictionary <int, List <Profile> >(); foreach (Profile profile in profiles) { List <Profile> directionProfiles; if (!profilesByDirectionId.TryGetValue(profile.Direction_id, out directionProfiles)) { directionProfiles = new List <Profile>(); profilesByDirectionId.Add(profile.Direction_id, directionProfiles); } directionProfiles.Add(profile); } foreach (Direction direction in directions) { directionsById.Add(direction.Id, direction); } foreach (var direction in directions) { HashSet <int> _id = new HashSet <int>(); var directionProfiles = profilesByDirectionId[direction.Id]; DirectionControl directionControl = new DirectionControl(direction, directionProfiles); directionsDB.Controls.Add(directionControl); directionControl.BtnUp.Visible = false; directionControl.BtnDown.Visible = false; directionControl.CloseControl.Visible = false; directionControl.Click += (s, e) => { bool isFound = _id.Contains(direction.Id); if (!isFound) { _id.Add(direction.Id); AddToCart(direction); saveButton.Enabled = true; } }; } clearCart.Click += (s, e) => profile_repository.clearCartbd(); }
public WhenExecutingMission() { var logger = new NullLoggerFactory().CreateLogger("Logger"); var directionControl = new DirectionControl(); var movementControl = new MovementControl(); var planControl = new PlanControl(logger); var navigationControl = new NavigationControl(movementControl, directionControl, logger); _missionControl = new MissionControl(logger, navigationControl, planControl); }
// Use this for initialization void Start() { stateID = states.NullState; stateMachine = new StateMachine <TurnBaseController>(this); stateMachine.ChangeState(FirstPlayerTurn.Instance); stateID = states.StrategyMode; ManagerDirectControl = FindObjectOfType <DirectionControl>(); PlayerManager[1].SetActive(false); }
public DirectionControl ControlBoundaries(Point p) { DirectionControl dc = new DirectionControl(); //Case: Image Hits Top Limit //We are at the Top corner => We Move Back Down if (p.Y < 10) { p.Y = p.Y + 5; dc.PointLocationY = p.Y; dc.PointLocationX = p.X; //We Change Direction and We Indicate the Image hit the top dc.EnumDirectionToMove = ChangeDirection(ImageBitMapMoving.Move.Up); return(dc); } //Case: Image Hits Bottom Limit //We are at the Bottom corner => We Move Back Up if (p.Y > 450) { p.Y = p.Y - 5; dc.PointLocationY = p.Y; dc.PointLocationX = p.X; //We Change Direction and We Indicate the Image hit the bottom dc.EnumDirectionToMove = ChangeDirection(ImageBitMapMoving.Move.Down); return(dc); } //Case: Image Hits Left Limit //We are at the left corner => We Move Back right if (p.X < 10) { p.X = p.X + 5; dc.PointLocationY = p.Y; dc.PointLocationX = p.X; //We Change Direction and We Indicate the Image hit the left dc.EnumDirectionToMove = ChangeDirection(ImageBitMapMoving.Move.Left); return(dc); } //Case: Image Hits Right Limit //We are at the right corner => We Move Back left if (p.X > 450) { p.X = p.X - 5; dc.PointLocationY = p.Y; dc.PointLocationX = p.X; //We Change Direction and We Indicate the Image hit the right dc.EnumDirectionToMove = ChangeDirection(ImageBitMapMoving.Move.Right); return(dc); } return(dc); }
protected override void OnSpawn() { base.OnSpawn(); base.smi.StartSM(); cleanMeter = new MeterController(GetComponent <KBatchedAnimController>(), "meter_clean_target", "meter_clean", Meter.Offset.Infront, Grid.SceneLayer.NoLayer, "meter_clean_target"); RefreshMeters(); Subscribe(-1697596308, OnStorageChangeDelegate); DirectionControl component = GetComponent <DirectionControl>(); component.onDirectionChanged = (Action <WorkableReactable.AllowedDirection>)Delegate.Combine(component.onDirectionChanged, new Action <WorkableReactable.AllowedDirection>(OnDirectionChanged)); OnDirectionChanged(GetComponent <DirectionControl>().allowedDirection); }
private void timer1_Tick(object sender, EventArgs e) { /********* * If we uncomment this block the speed of the flapping wings will * be the same as the speed of the movement of the Bee. * Because the timer is at a number of milliseconds for all the functions * if (count < 6) * { * count++; * bm = rend.AnimateBees()[count]; * //This method forces the Parser to Jump to the Paint Event and do the painting * Refresh(); * } **********/ p = render.GenerateMovement(newDirectionEnum, p); this.Refresh(); //Refresh(); /*********BOUNDARIES***************************** * We Constantly check the position of the Player * In relation to the Boundaries. * a |---------------------------------|d * | | * | | * | | * | | * | | * | | * b|---------------------------------|c * Vector a=(x,y) * Vector b=(x,y+height) * Vector c=(x+width, y+height) * Vector d=(x+width, y) * * * */ dc = render.ControlBoundaries(p); if (dc.EnumDirectionToMove != null && dc.PointLocationX != 0 && dc.PointLocationY != 0) { p.X = dc.PointLocationX; p.Y = dc.PointLocationY; newDirectionEnum = dc.EnumDirectionToMove; } this.Refresh(); //Refresh(); }
public void SetControl(DirectionControl control) { this.DirectionControl = control; }
public PlayerSprite() : base() { DirectionControl = DirectionControl.Rotational; movement = new MovementController(); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonUp(0)) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, RayLength, layerMask)) { hittedObject = hit.transform; if (hit.transform.tag != "Points") { return; } if (ManagerCharSelectLogic.ManagerTurnController.stateID == TurnBaseController.states.StrategyMode) { ManagerDirectionControl = ManagerTurnControl.PlayerManager[0].GetComponent <CharacterSelectLogic>().transform.GetChild((int)ManagerTurnControl.PlayerManager[0].GetComponent <CharacterSelectLogic>().currentChar).GetComponent <DirectionControl>(); ManagerDirectionControl.AssignDeffense(); // ManagerDirectionControl.AssignDeffense(); } else if (ManagerCharSelectLogic.ManagerTurnController.stateID == TurnBaseController.states.Attacker) { if (ManagerTurnControl.AttackFirstPos[(int)ManagerCharSelectLogic.currentChar] == true) { return; } ManagerTurnControl.PlayerManager[1].GetComponent <CharacterSelectLogic>().transform.GetChild((int)ManagerTurnControl.PlayerManager[0].GetComponent <CharacterSelectLogic>().currentChar).GetComponent <DirectionControl>().AssignAttacker(); // ManagerDirectionControl.AssignAttacker(); } } #region edited /* * RaycastHit hit; * Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); * if(Physics.Raycast(ray,out hit,RayLength,layerMask)) * { * if (hit.transform!=null) * { * * if (CheckPlaced[IndexLimit]) * { * return; * } * * Debug.Log(hit.transform.name); * ManagerCharSelectLogic.CharacterPoint[(int)ManagerCharSelectLogic.currentChar].transform.position = hit.transform.position; * * IndexLimit = (int)ManagerCharSelectLogic.currentChar; * * * ManagerChar.instance.CharIndex[IndexLimit].GetComponent<Button>().interactable = false; * CheckPlaced[IndexLimit] = true; * TotalPlaced += 1; * for (int i = 0; i < ManagerCharSelectLogic.CharacterPoint[ManagerChar.instance.CharIndexGlobal].GetComponent<DirectionControl>().movTrigger.dirDetector.Length; i++) * { * ManagerCharSelectLogic.CharacterPoint[IndexLimit].GetComponent<DirectionControl>().movTrigger.dirDetector[i].gameObject.SetActive(false); * * } * * * if (TotalPlaced < CheckPlaced.Length && IndexLimit < 3) * { * IndexLimit += 1; * ManagerCharSelectLogic.currentChar += 1; * while (CheckPlaced[IndexLimit]) * { * IndexLimit += 1; * ManagerCharSelectLogic.currentChar += 1; * if (IndexLimit > 3) * { * IndexLimit = 0; * ManagerCharSelectLogic.currentChar = 0; * } * * * } * * } * else if (TotalPlaced < CheckPlaced.Length && IndexLimit >= 3) * { * IndexLimit = 0; * ManagerCharSelectLogic.currentChar = 0; * while (CheckPlaced[IndexLimit]) * { * IndexLimit += 1; * ManagerCharSelectLogic.currentChar += 1; * if (IndexLimit > 3) * { * IndexLimit = 0; * ManagerCharSelectLogic.currentChar = 0; * } * * * } * * } * * * } */ #endregion } }
public WhenGettingNextDirectionInDirectionControl() { _directionControl = new DirectionControl(); }
// Use this for initialization void Start() { ManagerCharSelectLogic = FindObjectOfType <CharacterSelectLogic>(); ManagerDirectionControl = FindObjectOfType <DirectionControl>(); ManagerTurnControl = FindObjectOfType <TurnBaseController>(); }