public void TakeGel() { if (this.SelectedBJ == null) { return; } var resmanager = ResManager.getInstance(); var generater = ActionGenerater.getInstance(); var seque = Sequence.create(); seque.AddAction(MoveTo.create(handDevice, 3000, -1, -1, 0)); if (SelectedBJ is T_BJ_GelSeat gel_seat) { var take_seat = resmanager.SearchGelCard("T_BJ_GelSeat", gel_seat.Code, "", SeatIndex); generater.GenerateTakeGelFromNormal(take_seat, ref seque); } else if (SelectedBJ is T_BJ_Centrifuge cen_seat) { var take_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", cen_seat.Code, "", SeatIndex); var act = generater.GenerateTakeGelFromCent(take_seat, cen_seat.Code, ref seque); } else if (SelectedBJ is T_BJ_GelWarehouse ware_seat) { var take_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", ware_seat._Code, "", SeatIndex); var act = generater.GenerateTakeGelFromWare(take_seat, ref seque); } seque.runAction(handDevice); }
public EnemyPiece( Vector2 pos, Vector2 targetPos, float lifeTime ) { Position = pos; TargetPosition = targetPos; LifeTime = lifeTime; Sprite = Support.TiledSpriteFromFile("/Application/assets/bomb.png", 6, 10); this.AddChild(Sprite); CollisionDatas.Add(new EntityCollider.CollisionEntry() { type = EntityCollider.CollisionEntityType.EnemyPiece, owner = this, collider = Sprite, center = () => GetCollisionCenter(Sprite), radius = () => Radius, }); // const float SingleFrame = 1.0f / 60.0f; AddAnimation("Idle", new Support.AnimationAction(Sprite, 0, 6, LifeTime, looping: false)); SetAnimation(Sprite, "Idle"); // Logger.Debug("[EnemyPiece] pos:{0}, target:{1}", Position.ToString(), TargetPosition.ToString()); var mv = new MoveTo(TargetPosition, LifeTime); MoveToAction = mv; this.RunAction(mv); }
void Awake() { // Init vars utility = Utility.GetInstance(); // Enemy ship if (isShip) { // Init enemy ship ship = Instantiate(utility.shipsEnemy [Random.Range(0, utility.shipsEnemy.Length)].gameObject, transform).GetComponent <Ship> (); moveTo = GetComponent <MoveTo> (); movePoints = GameObject.FindGameObjectsWithTag("Enemy Point"); // Switch target (and repeat) switchMoveTarget(); InvokeRepeating("switchMoveTarget", 0, switchMoveTimer); } // Enemy turret else if (isTurret) { // Init enemy turret turret = Instantiate(utility.turretsEnemy [Random.Range(0, utility.turretsEnemy.Length)].gameObject, transform).GetComponent <Turret> (); // Set move speed of destroyed object to current speed turret.transform.Find("Model (Dead)").GetComponent <Move> ().directionSpeed = GetComponent <Move> ().directionSpeed; } }
public void test_basic_deferred_animation() { this.TearDownAnimations(); AnimationManager.Default.Configure(Streams.STREAM_0, AnimationStreamType.DEFER, 1); var blank = this.SpawnBlank(); var anim = new MoveTo(new Vector3(1, 1, 1)); var curve = new Linear(1f); var blank2 = this.SpawnBlank(); var anim2 = new MoveTo(new Vector3(1, 1, 1)); var curve2 = new Linear(1f); int events = 0; AnimationManager.Default.Add(Streams.STREAM_0, anim, curve, blank); AnimationManager.Default.Add(Streams.STREAM_0, anim2, curve2, blank2); AnimationManager.Default.AddEventHandler((ep) => { events += 1; }); var timer = AnimationHandler.Default; // Step AnimationHandler.Default.Update(1.0f); Assert(events == 1); // Step AnimationHandler.Default.Update(1.0f); Assert(events == 2); // Teardown TearDownAnimations(); }
// Update is called once per frame void Update() { if (mouseHold && Input.GetMouseButtonUp(0)) { mouseHold = false; var minDst = float.MaxValue; var minAlign = DragObject.transform.position; var idx = 0; for (var i = 0; i < AlignPosition.Length; i++) { var align = AlignPosition[i]; var dst = (DragObject.transform.position - align).magnitude; if (dst < minDst) { idx = i; minDst = dst; minAlign = align; } } MoveTo.MoveOptions options = new MoveTo.MoveOptions(DragObject, minAlign, AlignTime); options.OnFinished += (sender, e) => { var callback = DragObject.GetComponent <WaypointCallback>(); if (callback != null) { callback.ConnectCallback(idx); } }; MoveTo.Start(options); } if (mouseHold) { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; var dv = new Vector3(); if (Physics.Raycast(ray, out hit, 500, 1 << 8)) { dv.y = hit.point.y - holdPos.y; print(hit.point); dv.y *= DragVector.y; } if (Physics.Raycast(ray, out hit, 500, 1 << 9)) { dv.x = hit.point.x - holdPos.x; dv.x *= DragVector.x; } if (Physics.Raycast(ray, out hit, 500, 1 << 10)) { dv.z = hit.point.z - holdPos.z; dv.z *= DragVector.z; } DragObject.transform.position = startPos + dv; var callback = DragObject.GetComponent <WaypointCallback>(); if (callback != null) { callback.DisConnectCallback(0); } } }
private void Start() { Move = GetComponent <MoveTo>(); EventManager.Instance.GameOverRegular += OnGameOverRegular; EventManager.Instance.GameOverTimeOut += OnGameOverTimeOut; }
public void test_basic_working_animation() { this.TearDownAnimations(); AnimationManager.Default.Configure(Streams.STREAM_0, AnimationStreamType.REJECT, 1); var blank = this.SpawnBlank(); var anim = new MoveTo(new Vector3(1, 1, 1)); var curve = new Linear(1f); int events = 0; AnimationManager.Default.Add(Streams.STREAM_0, anim, curve, blank); AnimationManager.Default.AddEventHandler((ep) => { events += 1; }); // Step AnimationHandler.Default.Update(0.5f); Assert(events == 0); // Step AnimationHandler.Default.Update(0.5f); Assert(events == 1); // Teardown TearDownAnimations(); }
public Command(string state, char symbol, MoveTo move, string repr) { State = state; Symbol = symbol; Move = move; Repr = repr; }
public void TestMoveToInstruction() { var drone = CreateDrone(); var date = new DateTime(2018, 1, 1); var dest = new CoordinateInt2D() { X = 45, Y = 45 }; var source = new CoordinateInt2D() { X = 1, Y = 1 }; var globalInstruction = new GlobalInstruction() { TYPE = "MoveTo", Destination = dest, DroneName = "Drone_1" }; var playerCtx = new PlayerContext() { Level = 1 }; var mapper = new InstructionMapper(playerCtx); var expectedInstruction = new MoveTo(playerCtx, drone, date, source, dest); var actualInstruction = mapper.ToSpecificInstruction(globalInstruction, drone, date); actualInstruction.Should().BeEquivalentTo(expectedInstruction); }
// Use this for initialization void Start() { mesh = GetComponent <MeshRenderer>(); enemy = GetComponent <MoveTo>(); agent = GetComponent <NavMeshAgent>(); StartCoroutine("Wander"); }
public void PutDownGel() { if (this.SelectedBJ == null) { return; } var resmanager = ResManager.getInstance(); var generater = ActionGenerater.getInstance(); var seque = Sequence.create(); seque.AddAction(MoveTo.create(3000, -1, -1, 0)); var put_gel = resmanager.handseat_resinfo; if (SelectedBJ is T_BJ_GelSeat gel_seat) { var put_seat = resmanager.SearchGelCard("T_BJ_GelSeat", gel_seat.Code, "", SeatIndex); generater.GeneratePutGelToNormal(put_seat, put_gel, ref seque); } else if (SelectedBJ is T_BJ_Centrifuge cen_seat) { var put_seat = resmanager.SearchGelCard("T_BJ_Centrifuge", cen_seat.Code, "", SeatIndex); generater.GeneratePutGelToCent(cen_seat.Code, put_seat, put_gel, ref seque); } else if (SelectedBJ is T_BJ_GelWarehouse ware_seat) { var put_seat = resmanager.SearchGelCard("T_BJ_GelWarehouse", ware_seat.Code, "", SeatIndex); generater.GeneratePutGelToWare(put_seat, put_gel, ref seque); } else if (SelectedBJ is T_BJ_WastedSeat wasted_seat) { var put_seat = resmanager.SearchGelCard("T_BJ_WastedSeat", "", "1", SeatIndex); generater.GeneratePutGelToNormal(put_seat, put_gel, ref seque); } seque.runAction(handDevice); }
//生成卡仓抓卡动作 public ResInfoData GenerateTakeGelFromWare(ResInfoData take_seat, ref Sequence seque, string gelmask = "") { if (take_seat != null) { //卡仓位移动 //抓手移动到卡仓机位 var move_act = Spawn.create( MoveTo.create(Engine.getInstance().gelwareDevice, 3001, take_seat.StoreX, -1, -1), MoveTo.create(Engine.getInstance().handDevice, 3001, take_seat.X, take_seat.Y)); seque.AddAction(move_act); //抓手抓卡 var take_act = HandTakeCard.create(Engine.getInstance().handDevice, 3001, take_seat.Z, take_seat.ZLimit, take_seat.ZCatch, 0); seque.AddAction(take_act); //把测试卡放在卡仓Gel位中 var geltem = take_seat.Values[take_seat.CountX, 0]; take_seat.Values[take_seat.CountX, 0] = null; take_act.successfun = (ActionBase act) => { ResManager.getInstance().handseat_resinfo = (ResInfoData)geltem; return(true); }; take_act.destroyfun = (ActionBase act) => { take_seat.Values[take_seat.CountX, 0] = geltem; return(true); }; } else { ErrorSystem.WriteActError("卡仓无卡", true, false); } return(take_seat); }
public void ExecuteGWMove(String flag) { bool result = false; switch (flag) { case "X+": { GelWareDistanceX += StepXValue; GelWareDistanceX = Math.Min(GelWareDistanceX, Convert.ToDecimal(this.gelwareDevice.GelWare.XMotor.Maximum.SetValue)); var act = MoveTo.create(3000, (int)GelWareDistanceX); act.runAction(gelwareDevice); break; } case "X-": { GelWareDistanceX -= StepXValue; GelWareDistanceX = Math.Max(GelWareDistanceX, 0); var act = MoveTo.create(3000, (int)GelWareDistanceX); act.runAction(gelwareDevice); break; } } ShowResult(result); }
private void MoveSelectedItemTo(MoveTo moveTo) { TreeNode node = _groupsTreeView.SelectedNode; if (node != null) { TreeNodeCollection nodes = node.Parent == null ? _groupsTreeView.Nodes : node.Parent.Nodes; int index = node.Index; int newIndex = index; switch (moveTo) { case MoveTo.Top: newIndex = 0; break; case MoveTo.Bottom: newIndex = nodes.Count - 1; break; case MoveTo.Up: if (newIndex > 0) { newIndex--; } break; case MoveTo.Down: if (newIndex < nodes.Count) { newIndex++; } break; } if (index != newIndex) { _inMoving = true; try { _groupsTreeView.SelectedNode = null; nodes.RemoveAt(index); nodes.Insert(newIndex, node); if (node.Parent != null) { ChannelGroup currentGroup = node.Parent.Tag as ChannelGroup; _groupsWithDirtyChannels[currentGroup.ChannelGroupId] = true; RemoveCheckboxOnNode(node); } else { RemoveGroupChannelsCheckBoxes(node); } _groupsTreeView.SelectedNode = node; } finally { _inMoving = false; } } } }
public void TestDestinationEqualSource() { var source = new CoordinateInt2D() { X = 1, Y = 1 }; var drone = new Drone(source) { Name = "someDrone", StorageSize = 10, Speed = 1 }; var playerCtx = new PlayerContext() { Level = 1 }; var dateStart = new DateTime(2018, 1, 1, 0, 0, 0); Action action = () => { var move = new MoveTo(playerCtx, drone, dateStart, source, source); }; action.Should().Throw <InvalidInstructionException>() .WithMessage("The drone is already at destination"); }
// Use this for initialization protected override void Start() { m_Agent = GetComponent <NavMeshAgent>(); wants = new Root("Wants"); Sequence ns = new Sequence("wants Sequence", wants); GameObject wa = GameObject.Find("WorkArea"); GameObject ea = GameObject.Find("EatArea"); GameObject ra = GameObject.Find("RestArea"); GameObject ra2 = GameObject.Find("RestArea2"); MoveTo m1 = new MoveTo("MoveToWork", ns, this.gameObject, wa); MoveTo m2 = new MoveTo("MoveToEat", ns, this.gameObject, ea); MoveTo m3 = new MoveTo("MoveToRest", ns, this.gameObject, ra); MoveTo m4 = new MoveTo("MoveToRest2", ns, this.gameObject, ra2); ns.addChild(m1); ns.addChild(m2); ns.addChild(m3); ns.addChild(m4); wants.addChild(ns); }
public void SpawnContractor(Vector3 _positionToMoveTo, IssueController _issueClicked) { if (ContractorsSpawned < MaxContractors) { //TODO position of spawn point GameObject newContractor = Instantiate(ContractorPrefab, PointToSpawn.position, Quaternion.identity, transform.parent.parent); MoveTo script = newContractor.GetComponent <MoveTo>(); if (script) { script.MyHQ = this; script.ContractorUICanvas = ContractorUICanvas; script.SetGoal(_issueClicked, _positionToMoveTo); script.HappinessObject = Happiness; script.EffectsObject = EffectsObject; script.PlusParticleObject = PlusParticleObject; script.ContractorType = ContractorType; script.SatisfactionManager = SatisfactionManager; } else { Debug.Log("No MoveTo Script found on object"); } ContractorsSpawned++; Money.SubtractMoney(20.0f); } }
public void SetSelectedHQ(HQManager _hq) { if (SelectedContractor) { SelectedContractor.MyContractorUI.GetComponentInChildren <Image>().color = Color.white; SelectedContractor = null; } if (SelectedHQ) { SelectedHQ.SetSelected(false); } if (SelectedIssue) { _hq.SpawnContractor(SelectedIssue.myTile.transform.position, SelectedIssue); m_bIsSelectingHQ = false; SelectedIssue.SetSelected(false); SelectedIssue = null; } else { SelectedHQ = _hq; _hq.SetSelected(true); } }
// Use this for initialization void Start() { Player.i.gc.AssignmentsDict.Add(GetComponent <Monster>(), new List <Golem>()); move = GetComponent <MoveTo>(); nav = GetComponent <NavMeshAgent>(); //Debug.Log(Player.i.gc.AssignmentsDict.Count); }
public override void Execute() { if (MoveTo == null) { Parent.Messages.Add(Resources.MSG_AI_INVALID_DESTINATION); Parent.PopState(); return; } //// Arrived at my location if (MoveTo.Equals(Location)) { Parent.Messages.Add(Resources.MSG_AI_ALREADY_AT_DESTINATION); Parent.PopState(); return; } var exit = Location.Portals.Single(x => x.TargetSpace == MoveTo.SpaceDef); if (exit == null) { Parent.Messages.Add(Resources.MSG_AI_NO_PORTAL_TO_DESTINATION); Parent.PopState(); return; } // TODO: Execute the move command //var moveCmd = CommandManager.Instance.GetCommand("playermove"); //moveCmd.Execute(CommandManager.Instance.PopulateCommandArgs(Parent.Owner as IBiota, null, null, exit.Keywords)); }
//生成在普通位抓卡 public ResInfoData GenerateTakeGelFromNormal(ResInfoData take_seat, ref Sequence seque) { if (take_seat != null) { //抓手移动 seque.AddAction(MoveTo.create(Engine.getInstance().handDevice, 3001, (int)take_seat.X, (int)(take_seat.Y), 0)); //抓手抓卡 var take_act = HandTakeCard.create(Engine.getInstance().handDevice, 3001, (int)take_seat.Z, (int)take_seat.ZLimit, (int)take_seat.ZCatch, 0); seque.AddAction(take_act); //把测试卡放在Gel位中 var geltem = take_seat.Values[take_seat.CountX, 0]; if (take_seat.Values != null) { take_seat.Values[take_seat.CountX, 0] = null; } take_act.successfun = (ActionBase act) => { ResManager.getInstance().handseat_resinfo = (ResInfoData)geltem; return(true); }; take_act.destroyfun = (ActionBase act) => { take_seat.Values[take_seat.CountX, 0] = geltem; return(true); }; } else { ErrorSystem.WriteActError("普通位找不到卡", true, false); } return(take_seat); }
public override ActionBase InitAll() { var seque = Sequence.create(InitXyz.create(this, 10000, true, false, false)); foreach (var ware_seat in ResManager.getInstance().gelwarehouse_list) { seque.AddAction(MoveTo.create(this, 5000, (int)ware_seat.DetectX)); seque.AddAction(SkCallBackFun.create((ActionBase acttem) => { var res = TestGelCard(); if (res != null) { for (int i = 0; i < ware_seat.Count; i++) { ware_seat.Values[i, 0] = null; if (res[i + (int)ware_seat.DoorX]) { var resinfo = new ResInfoData(); ware_seat.Values[i, 0] = resinfo; } } } return(true); })); } seque.AddAction(ScanGelFromWare.create(handDevice, 20000, this)); seque.AddAction(MoveTo.create(this, 5000, 0)); seque.AddAction(InitXyz.create(this, 10000, true, false, false)); return(seque); }
public void TestMoveOutsideOfTheMap() { var source = new CoordinateInt2D() { X = 10, Y = 10 }; var dest = new CoordinateInt2D() { X = -1, Y = -1 }; var drone = new Drone(source) { Name = "someDrone", StorageSize = 10, Speed = 1 }; var playerCtx = new PlayerContext() { Level = 1 }; var dateStart = new DateTime(2018, 1, 1, 0, 0, 0); Action action = () => { var move = new MoveTo(playerCtx, drone, dateStart, source, dest); }; action.Should().Throw <InvalidInstructionException>() .WithMessage("Destination is outside of the map."); }
void removeSelf() { _BoxState = BoxState.Box_Destroyed; _MoveTo.stopTask(); _MoveTo = null; Destroy(gameObject); }
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { ResetDialog(); ResetTutorialManager(); anim = animator; dialogueBox = DialogueBox.Instance.Dialogue; if (!dialogueBox) { Debug.Log("DialogueBox Not Found"); return; } moveDialog = dialogueBox.GetComponent <MoveTo>(); if (!moveDialog) { Debug.Log("Dialog Script MoveTo Not Found"); return; } gameOuterContainer = (GameObject)GameObject.Find("GameOuterContainer"); gameContainer = gameOuterContainer.transform.Find("GameContainer").gameObject; if (!gameContainer) { Debug.Log("GameContainer Not Found"); } CoRoutineSlave.Instance.ExecCoroutine(Sequence()); }
//生成放卡在普通位 public bool GeneratePutGelToNormal(T_Gel gel, ref Sequence seque, string code = "", int seatindex = -1) { var resmanager = ResManager.getInstance(); T_BJ_GelSeat gelselect = (T_BJ_GelSeat)resmanager.SearchGelCard(typeof(T_BJ_GelSeat).Name, gel, false, code, seatindex); if (gelselect != null) { //抓手移动 seque.AddAction(MoveTo.create(300000, (int)gelselect.X, (int)(gelselect.Y + gelselect.Gap * seatindex), 0)); //抓手放卡 seque.AddAction(HandPutCard.create(500000, (int)gelselect.ZPut, 0)); //把测试卡放在Gel位中 gelselect.Values[seatindex, 0] = gel; seque.destroyfun = (ActionBase act) => { gelselect.Values[seatindex, 0] = null; return(true); }; } else { ErrorSystem.WriteActError(gelselect.Code + "位已满"); } return(gelselect != null); }
//生成离心机抓卡动作 public bool GenerateTakeGelFromCent(T_Gel gel, ref Sequence seque, string code = "", int seatindex = -1) { var resmanager = ResManager.getInstance(); T_BJ_Centrifuge gelselect = (T_BJ_Centrifuge)resmanager.SearchGelCard(typeof(T_BJ_Centrifuge).Name, gel, true, code, seatindex); var centrifuge = cenMrg.GetCentrifugeByCode(code); if (centrifuge == null) { centrifuge = cenMrg.GetFreeCentrifuge(); } if (gelselect != null) { //离心机位移动 //抓手移动到离心机位 var move_act = Spawn.create( MoveTo.create(centrifuge, 30000, -1, -1, (int)(seatindex * (double)gelselect.Gel0), 5), MoveTo.create(handDevice, 30000, (int)gelselect.HandX, (int)gelselect.HandY)); seque.AddAction(move_act); //抓手抓卡 seque.AddAction(HandTakeCard.create(700000, (int)gelselect.HandZ, (int)gelselect.ZLimit, (int)gelselect.ZCatch, 0)); //把测试卡放在离心Gel位中 gelselect.Values[seatindex, 0] = null; seque.destroyfun = (ActionBase act) => { gelselect.Values[seatindex, 0] = gel; return(true); }; } else { ErrorSystem.WriteActError("离心机位打不到卡"); } return(gelselect != null); }
public static async Task <bool> EnsureSalvageWindow() { var blacksmith = TownInfo.BlacksmithSalvage; if (blacksmith == null) { Core.Logger.Error("[SalvageItems] Unable to find a blacksmith info for this area :("); return(false); } while (!UIElements.SalvageWindow.IsVisible) { var blacksmithNpc = TownInfo.Blacksmith; if (blacksmithNpc != null) { Core.DBGridProvider.AddCellWeightingObstacle(blacksmithNpc.ActorId, 4); } if (!await MoveTo.Execute(blacksmith.InteractPosition)) { Core.Logger.Error($"[SalvageItems] Failed to move to blacksmith interact position ({blacksmith.Name}) to salvage items :("); return(false); } ; if (!await MoveToAndInteract.Execute(blacksmith, 10f)) { Core.Logger.Error($"[SalvageItems] Failed to move to blacksmith ({blacksmith.Name}) to salvage items :("); return(false); } ; await Coroutine.Wait(2000, () => UIElements.SalvageWindow.IsVisible); } return(true); }
public virtual async Task <bool> HandleAvoiding() { if (Core.Player.Actor == null || !IsAvoidanceRequired) { return(false); } var safe = (!Core.Player.IsTakingDamage || Core.Player.CurrentHealthPct > 0.5f) && Core.Player.Actor != null && !Core.Player.Actor.IsInCriticalAvoidance; if (!TrinityCombat.IsInCombat && Core.Player.Actor.IsAvoidanceOnPath && safe) { Core.Logger.Log(LogCategory.Avoidance, "Waiting for avoidance to clear (out of combat)"); return(await MoveTo.Execute(Core.Avoidance.Avoider.SafeSpot, "Safe Spot", 5f, () => !IsAvoidanceRequired)); } if (Core.Avoidance.Avoider.SafeSpot.Distance(Player.Position) < 5f) { return(false); } Core.Logger.Log(LogCategory.Avoidance, "Moving away from Critical Avoidance."); if (await MoveTo.Execute(Core.Avoidance.Avoider.SafeSpot, "Safe Spot", 5f, () => !IsAvoidanceRequired)) { return(true); } await CastDefensiveSpells(); return(true); }
private void MoveToRow(MoveTo WhichRow) { // if there are rows if (Tasks.Rows.Count > 0) { if (WhichRow == MoveTo.Last) // last is count - 1 { CurrentRow = Tasks.Rows.Count - 1; } else if (WhichRow == MoveTo.First) // first is 0 { CurrentRow = 0; } else { CurrentRow += (int)WhichRow; // prior or next append the index } // call method to update/change form controls FormChange(); } else { ClearForm(); } }
void Start() { Selector TreeRoot = new Selector(); Sequence Patrol = new Sequence(); MoveTo MoveToWP = new MoveTo(); PlayerChangeLane playerChangeLane = new PlayerChangeLane(); SelectNextGameObject PickNextWP = new SelectNextGameObject(); //TurnSpeed = 2.0f; //Speed = 5.0f; //Accuracy = 1.5f; SetValue("TurnSpeed", TurnSpeed); SetValue("Speed", Speed); SetValue("Accuracy", Accuracy); SetValue("Direction", 1); MoveToWP.TargetName = "Waypoint"; PickNextWP.ArrayKey = "Waypoints"; PickNextWP.GameObjectKey = "Waypoint"; PickNextWP.IndexKey = "Index"; PickNextWP.DirectionKey = "Direction"; Patrol.children.Add(MoveToWP); Patrol.children.Add(PickNextWP); Patrol.children.Add(playerChangeLane); TreeRoot.children.Add(Patrol); Patrol.tree = this; TreeRoot.tree = this; MoveToWP.tree = this; playerChangeLane.tree = this; PickNextWP.tree = this; root = TreeRoot; }
private void Move(MoveTo moveTo) { var target = this.transform.position; target += transform.forward * (Random.Range(-range.size.z, range.size.z) * 0.5f); target += transform.right * (Random.Range(-range.size.x, range.size.x) * 0.5f); target += transform.up * (Random.Range(-range.size.y, range.size.y) * 0.5f); var delay = Random.Range(minDelay, maxDelay); var moveTime = Random.Range(minMoveTime, maxMoveTime); var lookTime = Random.Range(minLookTime, maxLookTime); var easeType = easeTypes[Random.Range(0, easeTypes.Count)]; moveTo.Move(target, delay, moveTime, lookTime, easeType); }
// Use this for initialization void Start() { MoveTo curAct = new MoveTo (new Vector3(10,10,10),5); this.runAction (curAct); }
void OnCompleteMove(MoveTo completeMoveTo) { Move(completeMoveTo); }
// Use this for initialization void Start() { moveToScript = GetComponent<MoveTo> (); StartCoroutine ("FindTargetsWithDelay", .2f); }
public void Move(MoveTo side, double num = 1) { switch (side) { case MoveTo.Left: centerx -= (num * ratio); break; case MoveTo.Rigth: centerx += (num * ratio); break; case MoveTo.Up: centery += (num * ratio); break; case MoveTo.Down: centery -= (num * ratio); break; default: break; } }
private void MoveSelectedChannelsTo(MoveTo moveTo) { List<int> selectedIndexes = new List<int>(); foreach (DataGridViewRow row in _channelsDataGridView.SelectedRows) { selectedIndexes.Add(row.Index); } selectedIndexes.Sort(); if (moveTo == MoveTo.Down) { selectedIndexes.Reverse(); } List<Channel> selectedChannels = new List<Channel>(); foreach (int index in selectedIndexes) { selectedChannels.Add(GetChannelAtIndex(index)); } int movedChannelCounter = 0; foreach (Channel channel in selectedChannels) { if (channel != null) { int index = _channels.IndexOf(channel); int newIndex = index; switch (moveTo) { case MoveTo.Top: newIndex = 0 + movedChannelCounter; break; case MoveTo.Bottom: newIndex = _channels.Count - 1; break; case MoveTo.Up: if (newIndex > 0) { newIndex--; } break; case MoveTo.Down: if (newIndex < _channels.Count - 1) { newIndex++; } break; } if (index != newIndex) { _inChannelMoving = true; try { _channels.RemoveAt(index); _channels.Insert(newIndex, channel); _channelsBindingSource.ResetBindings(false); _channelsDataGridView.CurrentCell = _channelsDataGridView.Rows[newIndex].Cells[0]; } finally { _inChannelMoving = false; movedChannelCounter++; } } } } foreach (Channel channel in selectedChannels) { if (channel != null) { _channelsDataGridView.Rows[_channels.IndexOf(channel)].Selected = true; } } }