static public MoveBy Create(float duration, Vector3 deltaPosition, bool isLocal = false) { MoveBy ret = new MoveBy(); ret.InitWithDuration(duration, deltaPosition, isLocal); return(ret); }
IEnumerator Workflow() { FadeIn fadeIn = logo.AddComponent <FadeIn>(); fadeIn.time = 1.0f; fadeIn.Begin(); yield return(new WaitForSeconds(2f)); FadeOut fadeOut = logo.AddComponent <FadeOut>(); fadeOut.time = 1.0f; fadeOut.Begin(); yield return(new WaitForSeconds(1f)); logo.SetActive(false); loadingLayer.SetActive(true); yield return(new WaitForEndOfFrame()); MoveBy move = title.AddComponent <MoveBy>(); move.offset = new Vector3(0, -2f, 0); move.time = 1f; move.Begin(); yield return(new WaitForSeconds(1f)); async = SceneManager.LoadSceneAsync("MainScene"); async.allowSceneActivation = false; yield return(StartCoroutine(Loading())); text.text = "开始游戏"; button.enabled = true; }
public void ChangeRow(bool upward) { MoveBy move = gameObject.AddComponent <MoveBy>(); Vector3 offset = new Vector3(0, StageMap.GRID_HEIGHT, 0); if (!upward) { offset.y = -offset.y; } move.offset = offset; move.time = 0.5f; move.Begin(); model.zombieList[row].Remove(gameObject); if (upward) { ++row; } else { --row; } model.zombieList[row].Add(gameObject); display.SetOrderByRow(row); }
private void InitSequences() { var worldMap = SpaceUtil.WorldMap; float startYPosition = worldMap.Top.y + SpriteMap.HeightHalf; float targetYPosition = (worldMap.Center.y + (worldMap.Top.y * 2f)) * 0.333f; float yDiff = targetYPosition - startYPosition; Vector3 moveDistance = new Vector3(0, yDiff, 0); float rotateTimeHalf = RotateTime * 0.5f; // Initial sequence var moveDown = new MoveBy(this, moveDistance, InitialTravelTime); var setVelocity = new GameTaskFunc(this, () => Velocity = new Vector2(0, -FinalTravelSpeed)); var initialRotateLeft = new RotateTo(this, AngleDown, MinAngle, rotateTimeHalf); var initialSequence = new Sequence(moveDown, setVelocity, initialRotateLeft); // Infinite sequence var fireLeft = new GameTaskFunc(this, FireLeft); var rotateMiddle1 = new RotateTo(this, MinAngle, AngleDown, rotateTimeHalf); var fireDown = new GameTaskFunc(this, FireDown); var rotateRight = new RotateTo(this, AngleDown, MaxAngle, rotateTimeHalf); var fireRight = new GameTaskFunc(this, FireRight); var rotateMiddle2 = new RotateTo(this, MaxAngle, AngleDown, rotateTimeHalf); var rotateLeft = new RotateTo(this, AngleDown, MinAngle, rotateTimeHalf); var infiniteSequence = new Sequence(fireLeft, rotateMiddle1, fireDown, rotateRight, fireRight, rotateMiddle2, fireDown, rotateLeft); var repeat = new RepeatForever(infiniteSequence); Behavior = new EndlessSequence(repeat, initialSequence); }
async void MoveRandomly() { while (IsAlive) { var moveAction = new MoveBy(0.75f, new Vector3(RandomHelper.NextRandom(-0.4f, 0.4f), RandomHelper.NextRandom(-0.3f, 0.3f), 0)); await Node.RunActionsAsync(moveAction, moveAction.Reverse()); } }
/// <summary> /// Set boundaries for random movements /// </summary> protected async void MoveRandomly(float minX, float maxX, float minY, float maxY, float duration) { while (IsAlive) { var moveAction = new MoveBy(duration, new Vector3(RandomHelper.NextRandom(minX, maxX), RandomHelper.NextRandom(minY, maxY), 0)); await Node.RunActionsAsync(moveAction, moveAction.Reverse()); } }
//deprecated public void FlipFinal(float delay = 0f, bool withAnimation = true) { /* #region NEW_ADD * int sceneIndex = UnityEngine.SceneManagement.SceneManager.GetActiveScene ().buildIndex; * if (sceneIndex != (int)EScene.SCENE_Demo) { * return; * } #endregion */ Vector3 oldPos = transform.position; if (withAnimation) { _flipActionList.Clear(); FiniteTimeAction delayTime = null; if (delay > 0f) { delayTime = DelayTime.Create(delay); } //上移 FiniteTimeAction mby = MoveBy.Create(0.2f, Vector3.up * 10f); //翻过来 FiniteTimeAction mbt1 = RotateBy.Create(0.2f, Vector3.forward, 180f, Space.Self); //下移到原来的地方 FiniteTimeAction mbt2 = MoveTo.Create(0.2f, oldPos); FiniteTimeAction mbt3 = MoveTo.Create(0.2f, Vector3.up * 5f); FiniteTimeAction mbt4 = RotateTo.Create(0.2f, Vector3.zero); FiniteTimeAction mbt5 = InvokeAction.Create(delegate(GameObject target, object userdata) { //TableController.Instance.SetCurrentPlayedTile (this); }); if (delayTime != null) { _flipActionList.Add(delayTime); } _flipActionList.Add(mby); _flipActionList.Add(mbt1); _flipActionList.Add(mbt2); _flipActionList.Add(mbt3); _flipActionList.Add(mbt4); _flipActionList.Add(mbt5); ActionManager.Instance.RunAction(gameObject, _flipActionList); } else { //transform.Rotate (Vector3.forward, 180f, Space.Self); transform.rotation = Quaternion.identity; transform.position = Vector3.up * 5f; //TableController.Instance.SetCurrentPlayedTile (this); } }
public void Insert(Vector3 dstPosition, bool isLocal = false) { _insertActionList.Clear(); FiniteTimeAction mby = MoveBy.Create(0.1f, Vector3.up * MahjongTile.Thickness, isLocal); FiniteTimeAction mbt1 = MoveTo.Create(0.2f, dstPosition + Vector3.up * MahjongTile.Thickness, isLocal); FiniteTimeAction mbt2 = MoveTo.Create(0.1f, dstPosition, isLocal); _insertActionList.Add(mby); _insertActionList.Add(mbt1); _insertActionList.Add(mbt2); ActionManager.Instance.RunAction(gameObject, _insertActionList); }
public void AttackAnimation(Unit selectedUnit, Unit goalUnit, bool isDefenderInCity, Sequencer sequencer, ref int selectedUnitCurrentHealth, ref int goalUnitCurrentHealth, bool distanceAttack) { float bonusCity = isDefenderInCity ? goalUnit.Defense * 0.5f : 0.0f; bonusCity = selectedUnit.Type == UnitStats.UnitType.CATAPULT ? 0.0f : bonusCity; float totalAttack = selectedUnit.Attack + (goalUnit.Defense + bonusCity); float probabilityVictorySelected = (float)selectedUnit.Attack / (float)totalAttack; float attackResult = UnityEngine.Random.Range(0f, 1f); Unit unitToMove = null; Unit unitToHurt = null; if (attackResult <= probabilityVictorySelected) { goalUnitCurrentHealth--; unitToMove = selectedUnit; unitToHurt = goalUnit; } else if (!distanceAttack) { selectedUnitCurrentHealth--; unitToMove = goalUnit; unitToHurt = selectedUnit; } float offsetY = unitToMove.gameObject.GetComponent <MeshFilter>().mesh.bounds.size.y *unitToMove.gameObject.transform.localScale.y * 0.5f; Vector3 newPosition = new Vector3( unitToHurt.gameObject.transform.position.x, unitToHurt.gameObject.transform.position.y + offsetY, unitToHurt.gameObject.transform.position.z); Vector3 movement = newPosition - unitToMove.gameObject.transform.position; MoveBy unitMovementAnimation = new MoveBy(movement, 0.15f, unitToMove.gameObject); sequencer.Add(unitMovementAnimation); Caller togglePunchCaller = new Caller(); togglePunchCaller.ActionFunction = () => unitToHurt.ToggleWound(true); sequencer.Add(togglePunchCaller); MoveBy reverseUnitMovementAnimation = new MoveBy(-movement, 0.15f, unitToMove.gameObject); sequencer.Add(reverseUnitMovementAnimation); Caller reverseTogglePunchCaller = new Caller(); reverseTogglePunchCaller.ActionFunction = () => unitToHurt.ToggleWound(false); sequencer.Add(reverseTogglePunchCaller); Caller caller = new Caller(); caller.ActionFunction = () => unitToHurt.CurrentHealth--; sequencer.Add(caller); }
void ProduceSun() { float x = Random.Range(StageMap.LeftGrid, StageMap.RightGrid); float y = Random.Range(StageMap.BottomGrid, StageMap.TopGrid); float startY = StageMap.TopGrid + 1.5f; GameObject sun = Instantiate(sunPrefab); sun.transform.position = new Vector3(x, startY); MoveBy move = sun.AddComponent <MoveBy>(); move.Offset = new Vector3(0, y - startY, 0); move.MoveTime = (startY - y) / 1f; move.Begin(); }
void OnMouseDown() { _model.sun += value; MoveBy move = GetComponent <MoveBy>(); if (move) { move.enabled = false; } enabled = true; speed = (disappearPos - transform.position) / absorbTime; AudioManager.GetInstance().PlaySound(sound); Destroy(gameObject, absorbTime); }
IEnumerator GameReady() { yield return(new WaitForSeconds(0.5f)); MoveBy move = Camera.main.gameObject.AddComponent <MoveBy>(); move.offset = new Vector3(3.9f, 0, 0); move.time = 1f; move.Begin(); yield return(new WaitForSeconds(1.5f)); sunLabel.SetActive(true); cardDialog.SetActive(true); }
public void StartRise(float height) { Action <float> setHeight = x => HeightOffset = x; var rise = new ApplyFloatValueOverTime(this, setHeight, HeightOffset, height, AnimationTime); RunTask(rise); // Manually move since position is normally recalculated when the player is moved. Vector3 riseDistance = new Vector3(0, height - HeightOffset); var move = new MoveBy(this, riseDistance, AnimationTime); RunTask(move); }
void ProduceSun() { float x = Random.Range(StageMap.GRID_LEFT, StageMap.GRID_RIGTH); float y = Random.Range(StageMap.GRID_BOTTOM, StageMap.GRID_TOP); float startY = StageMap.GRID_TOP + 1.5f; GameObject sun = Instantiate(sunPrefab); sun.transform.position = new Vector3(x, startY, 0); MoveBy move = sun.AddComponent <MoveBy>(); move.offset = new Vector3(0, y - startY, 0); move.time = (startY - y) / 1.0f; move.Begin(); }
public async void Rotate() { if (planeNode == null) //not created yet { return; } var moveAction = new MoveBy(1f, new Vector3(0, 0, 5)); var rotateAction = new RotateBy(duration: 1, deltaAngleX: 0, deltaAngleY: 90, deltaAngleZ: 20); //planeNode.GetComponent<StaticModel>().Model = CoreAssets.Models.Sphere; //planeNode.SetScale(7f); await planeNode.RunActionsAsync(new Urho.Actions.Parallel(moveAction, rotateAction)); await planeNode.RunActionsAsync(new RepeatForever(new RotateBy(duration: 1, deltaAngleX: 0, deltaAngleY: 90, deltaAngleZ: 0))); }
public void pickUp() { model.sun += value; MoveBy move = GetComponent <MoveBy>(); if (move) { move.enabled = false; } isCollected = true; speed = (disappearPos - transform.position) / actionTime; AudioManager.GetInstance().PlaySound(sound); Destroy(gameObject, actionTime); }
protected override void OnUpdate(float timeStep) { var input = Input; const float duration = 1f; //2s FiniteTimeAction action = null; if (input.GetKeyPress(Key.W)) { action = new MoveBy(duration, new Vector3(0, 0, 5)); } if (input.GetKeyPress(Key.S)) { action = new MoveBy(duration, new Vector3(0, 0, -5)); } if (input.GetKeyPress(Key.E)) { action = new FadeIn(duration); } if (input.GetKeyPress(Key.Q)) { action = new FadeOut(duration); } if (input.GetKeyPress(Key.R)) { action = new EaseElasticInOut(new ScaleBy(duration, 1.3f)); } if (input.GetKeyPress(Key.G)) { action = new TintTo(duration, NextRandom(1), NextRandom(1), NextRandom(1)); } if (action != null) { //can be awaited boxNode.RunActionsAsync(action); } base.OnUpdate(timeStep); }
IEnumerator gameReady() { yield return(new WaitForSeconds(0.5f)); MoveBy move = Camera.main.gameObject.AddComponent <MoveBy>(); //move.Offset = new Vector2(3.25f, 0); move.Offset = new Vector2(5.7f, 0); move.MoveTime = 1.5f; move.Begin(); yield return(new WaitForSeconds(2f)); //sunLabel.SetActive(true); //shovelBg.SetActive(true); btn_sumbit.SetActive(true); toolBar.SetActive(true); //btn_reset.SetActive(true); //cardDialog.SetActive(true); }
void MoveUnit(GameObject unitToMove, HexCell cellToMoveTo) { float offsetY = unitToMove.GetComponent <MeshFilter>().mesh.bounds.size.y *unitToMove.transform.localScale.y * 0.5f; Vector3 newPosition = new Vector3(cellToMoveTo.transform.position.x, cellToMoveTo.transform.position.y + offsetY, cellToMoveTo.transform.position.z); Vector3 movement = newPosition - unitToMove.transform.position; MoveBy moveUnitAnimationBy = new MoveBy(movement, 0.25f, unitToMove); Caller caller = new Caller(); caller.ActionFunction = () => MoveUnitCallback(unitToMove, cellToMoveTo); Sequencer sequence = new Sequencer(); sequence.Add(moveUnitAnimationBy); sequence.Add(caller); animationController.Add(sequence); }
//deprecated public void Flip(float delay = 0f, bool withAnimation = true) { /* #region NEW_ADD * int sceneIndex = UnityEngine.SceneManagement.SceneManager.GetActiveScene ().buildIndex; * if (sceneIndex != (int)EScene.SCENE_Demo) { * return; * } #endregion */ Vector3 oldPos = transform.position; if (withAnimation) { _flipActionList.Clear(); FiniteTimeAction delayTime = null; if (delay > 0f) { delayTime = DelayTime.Create(delay); } //上移 FiniteTimeAction mby = MoveBy.Create(0.2f, Vector3.up * 10f); //翻过来 FiniteTimeAction mbt1 = RotateBy.Create(0.2f, Vector3.forward, 180f, Space.Self); //下移到原来的地方 FiniteTimeAction mbt2 = MoveTo.Create(0.2f, oldPos); if (delayTime != null) { _flipActionList.Add(delayTime); } _flipActionList.Add(mby); _flipActionList.Add(mbt1); _flipActionList.Add(mbt2); ActionManager.Instance.RunAction(gameObject, _flipActionList); } else { transform.Rotate(Vector3.forward, 180f, Space.Self); } }
public void MoveCamera() { //if (StaticDataMng._VibOn==1) // Handheld.Vibrate(); if (have.o_List.Count == 0) { MoveBy moveby = new MoveBy(gameObject, new Vector3(-15, 10, 0), true, false, 0.03f); have.o_List.Add(moveby); moveby = new MoveBy(gameObject, new Vector3(10, -5, 0), true, false, 0.03f); have.o_List.Add(moveby); moveby = new MoveBy(gameObject, new Vector3(-5, 5, 0), true, false, 0.03f); have.o_List.Add(moveby); moveby = new MoveBy(gameObject, new Vector3(15, -10, 0), true, false, 0.03f); have.o_List.Add(moveby); moveby = new MoveBy(gameObject, new Vector3(-10, 5, 0), true, false, 0.03f); have.o_List.Add(moveby); moveby = new MoveBy(gameObject, new Vector3(5, -5, 0), true, false, 0.03f); have.o_List.Add(moveby); } }
public virtual void Init(List <Piece> p, Vector3 deltaTargetPosition, BoardDirection boardDirection, float time, Action callback = null) { pieces = p; currentTask = 0; directionPosition = deltaTargetPosition; direction = boardDirection; taskCount = pieces.Count; onCompleteCallback = callback; if (currentTask == taskCount) { OnAllTaskDone(); } else { foreach (var i in pieces) { MoveBy task = new MoveBy(); task.Init(i, i.transform.localPosition + deltaTargetPosition, time, OnSingleTaskDone); } } }
public override void OnAttachedToNode(Node node) { base.OnAttachedToNode(node); Application.Input.TouchEnd += Input_TouchEnd; Application.Input.TouchBegin += Input_TouchBegin; cubeNode = node.CreateChild(); cubeNode.Position = new Vector3(1000, 1000, 1000); cubeNode.SetScale(0.02f); var box = cubeNode.CreateComponent <Box>(); box.Color = Color.White; var moveAction = new MoveBy(0.5f, new Vector3(0, 0.005f, 0)); cubeNode.RunActionsAsync(new RepeatForever(new RotateBy(1f, 0, 120, 0))); cubeNode.RunActionsAsync(new RepeatForever(moveAction, moveAction.Reverse())); camera = Scene.GetChildrenWithComponent <Camera>(true).First().GetComponent <Camera>(); octree = Scene.GetComponent <Octree>(true); }
protected override async void Start() { base.Start(); clientConnection = new ClientConnection(); clientConnection.Disconnected += ClientConnection_Disconnected; clientConnection.RegisterForRealtimeUpdate(GetCurrentPositionDto); clientConnection.RegisterFor <PointerPositionChangedDto>(OnClientPointerChanged); Zone.AmbientColor = new Color(0.3f, 0.3f, 0.3f); DirectionalLight.Brightness = 0.5f; environmentNode = Scene.CreateChild(); EnableGestureTapped = true; cubeNode = environmentNode.CreateChild(); cubeNode.SetScale(0.2f); cubeNode.Position = new Vector3(1000, 1000, 1000); var box = cubeNode.CreateComponent <Box>(); box.Color = Color.White; var moveAction = new MoveBy(0.5f, new Vector3(0, 0.005f, 0)); cubeNode.RunActions(new RepeatForever(new RotateBy(1f, 0, 120, 0))); cubeNode.RunActions(new RepeatForever(moveAction, moveAction.Reverse())); //material = Material.FromColor(Color.Gray); //-- debug mode material = Material.FromColor(Color.Transparent, true); await RegisterCortanaCommands(new Dictionary <string, Action> { { "stop spatial mapping", StopSpatialMapping } }); while (!await ConnectAsync()) { } }
void Shoot() { Vector3 pos = transform.position + bulletOffset; GameObject[] bullets = new GameObject[3]; for (int i = 0; i < 3; ++i) { bullets[i] = Instantiate(bullet); bullets[i].transform.position = pos; bullets[i].GetComponent <Bullet>().row = grow.row - 1 + i; bullets[i].GetComponent <SpriteRenderer>().sortingOrder = 1000 * (grow.row + i) + 1; } MoveBy move1 = bullets[0].AddComponent <MoveBy>(); move1.offset.Set(0, StageMap.GRID_HEIGHT, 0); move1.time = 0.2f; move1.Begin(); MoveBy move2 = bullets[2].AddComponent <MoveBy>(); move2.offset.Set(0, -StageMap.GRID_HEIGHT, 0); move2.time = 0.2f; move2.Begin(); }
void CallFuncTest() { btn_text.text = "点击停止"; var action = Sequence.Create( CallFunc.Create(CallBackO, "延时0.5秒"), DelayTime.Create(0.5f), CallFunc.Create(CallBackO, "图片移动"), MoveTo.Create(1f, 200, 100).InitSubjectTransform(image.transform), MoveTo.Create(1f, 0, 0).InitSubjectTransform(image.transform), CallFunc.Create(CallBackO, "颜色渐变"), ColorTo.Create(0.5f, 1, 0, 0, 1f).InitSubjectComponent(image), ColorTo.Create(0.5f, 0, 1, 0, 1f).InitSubjectComponent(image), ColorTo.Create(0.5f, 0, 0, 1, 1f).InitSubjectComponent(image), CallFunc.Create(CallBackO, "颜色reset"), ColorTo.Create(0.5f, 1, 1, 1, 1).InitSubjectComponent(image), CallFunc.Create(CallBackO, "渐隐"), FadeOut.Create(1f).InitSubjectComponent(image), CallFunc.Create(CallBackO, "渐出"), FadeIn.Create(1f).InitSubjectComponent(image), CallFunc.Create(CallBackO, "1秒闪烁5次"), Blink.Create(1f, 5), CallFunc.Create(CallBackO, "二阶贝塞尔曲线"), BezierTo.Create(2.0f, new Vector3(200, 100, 0), new Vector3(-100, 50, 0), new Vector3(100, 80, 0)).InitSubjectTransform(image.transform), CallFunc.Create(CallBackO, "移动回原点"), MoveTo.Create(1f, 0, 0).InitSubjectTransform(image.transform), CallFunc.Create(CallBackO, "边移动边放大"), Spawn.Create(MoveTo.Create(1.0f, 200, 100f), ScaleTo.Create(1.0f, 3.0f, 3.0f, 3.0f)), CallFunc.Create(CallBackO, "缩放位置回原位"), Spawn.Create(MoveTo.Create(1.0f, 0, 0), ScaleTo.Create(1.0f, 1f, 1f, 1f)), NumberBy.Create(2.0f, "数字跳跃,从100到200:{0:f2}", 100, 100).InitSubjectComponent(text), DelayTime.Create(0.5f), NumberTo.Create(2.0f, "数字跳跃,从200到0:{0:f2}", 200, 0).InitSubjectComponent(text), DelayTime.Create(0.5f), CallFunc.Create(CallBackO, "Image Filled"), FillAmountTo.Create(1.5f, 0f).InitSubjectComponent(image), FillAmountTo.Create(1.5f, 1.0f).InitSubjectComponent(image), CallFunc.Create(CallBackO, "reset"), CallFunc.Create(CallBackO, "旋转 放大2倍,复原。重复3次"), Repeat.Create(Spawn.Create( RotationBy.Create(1.0f, 0, 0, 360f), Sequence.Create( ScaleTo.Create(0.5f, 2.0f, 2.0f, 2.0f), ScaleTo.Create(0.5f, 1.0f, 1.0f, 1.0f))).InitSubjectTransform(image.transform), 3), ExtraAction.Create() ); float toX = 300f; var easeAction = Sequence.Create( CallFunc.Create(CallBackO, "变速运动演示,图一正常,图二是变速运动"), DelayTime.Create(1f), CallFunc.Create(CallBackO, "当前变速是EaseIn"), DelayTime.Create(0.5f), Spawn.Create( MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image.transform), EaseIn.Create(MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)), CallFunc.Create(CallBackO, "复位"), Spawn.Create( MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image.transform), EaseIn.Create(MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)), CallFunc.Create(CallBackO, "当前变速是EaseOut"), DelayTime.Create(0.5f), Spawn.Create( MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image.transform), EaseOut.Create(MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)), CallFunc.Create(CallBackO, "复位"), Spawn.Create( MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image.transform), EaseOut.Create(MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)), CallFunc.Create(CallBackO, "当前变速是EaseInOut"), DelayTime.Create(0.5f), Spawn.Create( MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image.transform), EaseInOut.Create(MoveBy.Create(1.0f, toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)), CallFunc.Create(CallBackO, "复位"), Spawn.Create( MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image.transform), EaseInOut.Create(MoveBy.Create(1.0f, -toX, 0f, 0f).InitSubjectTransform(image2.transform), 3f)), CallFunc.Create(CallBackO, "变速运动未完待续"), DelayTime.Create(1f), ExtraAction.Create() ); CCActionManager.Instance.AddAction(Sequence.Create(action, easeAction, CallFunc.Create(CallBackEnd)), transform); }
//deprecated later for lua IEnumerator shuffleAndInitPocket(/*GameInitPush? gip*/) { Debug.Log("!!!!!!!!!!!!!!!!!!!!!shuffleAndInitPocket"); int a = 3; //gip.Value.Dice (0); int b = 5; //gip.Value.Dice (1); _shuffle_initpocket_state = 0; //UIControllerGame.Instance.SetPaiRestInfo (_wall.Count); //UIControllerGame.Instance.RefreshPaiRestInfo (); Transform dice = poolMahjongRes.Spawn("DiceGroup"); ActionBase act = MoveBy.Create(1f, Vector3.down * MahjongTile.Height * 2); ActionManager.Instance.RunAction(_slot.gameObject, act); yield return(new WaitForSeconds(1f)); for (int i = 0; i < _playPlayers.Length; ++i) { _players [i] = _playPlayers [i]; } //hard code if (_playPlayers [_dealerIndex] == _self) { for (int i = 0; i < _playPlayers.Length; ++i) { if (_playPlayers [i] != _self) { for (int j = 0; j < 13; ++j) { _playPlayers [i].Proxy.PocketList.Add(TileDef.Create()); } } } } else { for (int i = 0; i < _playPlayers.Length; ++i) { if (_playPlayers [i] != _self) { if (i == _dealerIndex) { for (int j = 0; j < 14; ++j) { _playPlayers [j].Proxy.PocketList.Add(TileDef.Create()); } } else { for (int j = 0; j < 13; ++j) { _playPlayers [j].Proxy.PocketList.Add(TileDef.Create()); } } } } } if (_playPlayers.Length == 3) { if (_players [0] == _self) { _players [3] = _players [2]; _players [2] = _front; } else if (_players [1] == _self) { _players [3] = _front; } else if (_players [2] == _self) { _players [0] = _right; _players [1] = _front; _players [2] = _left; _players [3] = _self; } } //dealer and opposite dealer are 14 tons, others are 13tons _pile.RebuildStack(a, b, 108, 0, 0); int offset = _self.SetupStack(_pile, 0, 14 * 2); offset += _right.SetupStack(_pile, offset, 13 * 2); offset += _front.SetupStack(_pile, offset, 14 * 2); _left.SetupStack(_pile, offset, 13 * 2); act = MoveTo.Create(1f, _slotOriginal); ActionManager.Instance.RunAction(_slot.gameObject, act); yield return(new WaitForSeconds(1f)); // dice sound //AudioManager.Instance.PlaySound (AudioManager.Instance.Tou_Zi); DiceController.Instance.ThrowDice(a, b); Debug.Log("******" + DiceController.Instance.DiceDone); yield return(new WaitUntil(() => DiceController.Instance.DiceDone == true)); Debug.Log("Dice -> " + a + "," + b); for (int i = 0; i < 4; ++i) { _playPlayers [i].InitDraw(i == _dealerIndex); } //TableController.Instance.SetCurrentPlayer (GetPlayerDisplayIndex (_playPlayers [0])); // despawn dice poolMahjongRes.Despawn(dice, poolMahjongRes.transform); for (int i = 0; i < 4; ++i) { yield return(new WaitUntil(() => _playPlayers [i].InitDrawFinished == true)); } _shuffle_initpocket_state = 1; //UIControllerGame.Instance.OpenRefreshButton (); Debug.Log("@shuffleAndInitPocket"); }
public override void Execute() { if (m_DOTweenAction == null) { Debug.LogError("무브 액션이 설정안된 객체입니다. 설정해주시기 바랍니다. 에러객체 이름 및 좌표 : " + m_MonoBehaviour.gameObject.name + " / " + m_MonoBehaviour.gameObject.transform.position); return; } switch (m_DOTweenActionType) { case DOTweenActionType.MoveTo: { MoveTo to = m_DOTweenAction as MoveTo; m_MonoBehaviour.gameObject.transform .DOMove(to.GetEndPoint(), to.GetDuration()) .OnComplete(() => m_IsCompleted = true); } break; case DOTweenActionType.MoveBy: { MoveBy by = m_DOTweenAction as MoveBy; m_MonoBehaviour.gameObject.transform .DOBlendableMoveBy(by.GetEndPoint(), by.GetDuration()) .OnComplete(() => m_IsCompleted = true); } break; case DOTweenActionType.MovePaths: { MovePaths paths = m_DOTweenAction as MovePaths; m_MonoBehaviour.gameObject.transform .DOPath(paths.GetPaths(), paths.GetDuration(), paths.GetPathType()) .OnComplete(() => m_IsCompleted = true); } break; case DOTweenActionType.RotateTo: { RotateTo roateto = m_DOTweenAction as RotateTo; m_MonoBehaviour.gameObject.transform .DORotate(roateto.GetEndPoint(), roateto.GetDuration()) .OnComplete(() => m_IsCompleted = true); } break; case DOTweenActionType.RotateBy: { RotateBy roateby = m_DOTweenAction as RotateBy; m_MonoBehaviour.gameObject.transform .DOBlendableLocalRotateBy(roateby.GetEndPoint(), roateby.GetDuration()) .OnComplete(() => m_IsCompleted = true); } break; case DOTweenActionType.ColorTo: { ColorTo colorto = m_DOTweenAction as ColorTo; m_MonoBehaviour.gameObject.GetComponentInChildren <MeshRenderer>().material .DOColor(colorto.GetEndPoint(), colorto.GetDuration()) .OnComplete(() => m_IsCompleted = true); } break; case DOTweenActionType.ColorRewind: { ColorTo colorto = m_DOTweenAction as ColorTo; Material material = m_MonoBehaviour.gameObject.GetComponentInChildren <MeshRenderer>().material; Color oriColor = material.color; float duration = colorto.GetDuration() / 2; DOTween.Sequence() .Append(material.DOColor(oriColor, duration)) .Append(material.DOColor(colorto.GetEndPoint(), duration)) .OnComplete(() => m_IsCompleted = true); } break; case DOTweenActionType.ScaleTo: { ScaleTo scaleTo = m_DOTweenAction as ScaleTo; m_MonoBehaviour.gameObject.transform .DOScale(scaleTo.GetEndPoint(), scaleTo.GetDuration()) .OnComplete(() => m_IsCompleted = true); } break; } }
public void MoveRightBlock() { MoveBy moveby = new MoveBy(gameObject, new Vector3(79, 0, 0), true, false, 0.03f); have.o_List.Add(moveby); }
/// <summary> /// 精灵增量移动 /// </summary> /// <param name='vector'> /// 增量坐标 /// </param> /// <param name='speed'> /// 速度 /// </param> public void Moveby(Vector2 vector, float speed) { var moveBy = new MoveBy (new Vector2 (vector.X, -vector.Y), speed); this.RunAction (moveBy); }
public MoveBy Reverse() { return(MoveBy.Create(Duration, new Vector3(-PositionDelta.x, -PositionDelta.y, -PositionDelta.z))); }