private void HandleMovement() { float currentSpeed = walkSpeed; float currentMaxSpeed = walkMaxspeed; animationCurrentSpeed = animationWalkSpeed; if (inputAdapter.GetInput(InputAdapter.InputKey.TRIGGER)) { if (sprintTimeLeft >= 0) { sprintTimeLeft -= Time.deltaTime; currentSpeed = sprintSpeed; currentMaxSpeed = sprintMaxSpeed; carrot = null; onSprint?.Invoke(); animationCurrentSpeed = animationRunSpeed; } } else { sprintTimeLeft = Mathf.Min(sprintTimeLeft + sprintRecoverRate * Time.deltaTime, sprintMaxTime); } Vector3 newVel = inputAdapter.GetVelocity(body.velocity, currentSpeed); animationCurrentSpeed = Mathf.Min(animationCurrentSpeed, newVel.magnitude); animator.SetFloat("speed", animationCurrentSpeed); if (animationCurrentSpeed > 0.1f) { bird.start = true; } body.velocity = newVel; if (body.velocity.magnitude > 0.1f) { transform.rotation = Quaternion.LookRotation(body.velocity, Vector3.up); if (nextFootPrintsTime <= Time.time) { nextFootPrintsTime = Time.time + UnityEngine.Random.Range(timeBetweenFootPrintsMin, timeBetweenFootPrintsMax); GameObject newFoorPrint = Instantiate(footPrintsPrefab, footPrintsContainer); newFoorPrint.transform.position = new Vector3(transform.position.x, 0.1f, transform.position.z); newFoorPrint.transform.rotation = Quaternion.Euler(90, transform.rotation.eulerAngles.y + UnityEngine.Random.Range(-20, 20), transform.rotation.eulerAngles.z + UnityEngine.Random.Range(-20, 20)); Sequence sequence = DOTween.Sequence(); sequence.AppendInterval(timeBeforeShrink) .Append(newFoorPrint.transform.DOScale(Vector3.zero, shrinkDuration)) .OnComplete(() => Destroy(newFoorPrint)); playsound++; if (playsound % 4 == 0) { soundManager.PlaySnowSound(); } } } }
void Start() { if (Instance == null) { Instance = this; } else if (Instance != this) { Destroy(gameObject); } anim = GetComponentInChildren<Animator>(); }
public void ValueTest() { var reds = _sortByColorResult.SortedHay[Color.Red]; var greens = _sortByColorResult.SortedHay[Color.Green]; var blues = _sortByColorResult.SortedHay[Color.Blue]; decimal lastStraw = 0; foreach (var value in reds) { Straw straw = (Straw)((System.Collections.DictionaryEntry)value).Value; Assert.IsTrue(lastStraw < straw.LengthInCm, "Expected last strat to be less than current"); } }
public Drawer() { Properties = new Dictionary <string, ConfigValue>(); Brushes = new Dictionary <string, IBrush>(); this["MoveTool"] = new MoveTool(); this["Straw"] = new Straw(); this["Eraser"] = new Eraser(); this["Pencil"] = new Pencil(); Brush = this["MoveTool"]; LayerList = new List <IPaint> { new Canvas { Name = "LastLayer" }, new Canvas { Name = "CurrentLayer" } }; CurrentLayer.Visible = true; }
public void ColorTest() { foreach (var item in _sortByColorResult.SortedHay) { var color = item.Key; foreach (var value in item.Value) { Straw straw = (Straw)((System.Collections.DictionaryEntry)value).Value; if (color == Color.Red) { Assert.IsTrue(straw.ColorsWithValues[0].Value >= straw.ColorsWithValues[1].Value, "Expected to have higher count on red"); Assert.IsTrue(straw.ColorsWithValues[0].Value >= straw.ColorsWithValues[2].Value, "Expected to have higher count on red"); } else if (color == Color.Green) { Assert.IsTrue(straw.ColorsWithValues[1].Value <= straw.ColorsWithValues[2].Value, "Expected to have higher count on green"); Assert.IsTrue(straw.ColorsWithValues[0].Value <= straw.ColorsWithValues[2].Value, "Expected to have higher count on green"); } } } }
public void PickupStraw(Straw carrot, Action callback) { this.carrot = carrot; onSprint = callback; }
/// <summary> /// ギミック設置 /// by柏 SE実装 2016.12.14 /// </summary> /// <param name="mapdata">マップデータの二元配列</param> /// <param name="MapThings">マップ上の物のList</param> public static void CreateGimmicks(int[,] mapdata, List <GameObject> MapThings, Sound sound) { for (int i = 0; i < mapdata.GetLength(0); i++) { for (int j = 0; j < mapdata.GetLength(1); j++) { switch (mapdata[i, j]) { case (int)GimmickType.ICE: { Ice ice = new Ice(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(ice); break; } case (int)GimmickType.IRON: { Iron iron = new Iron(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(iron); break; } case (int)GimmickType.LIGHT: { Light light = new Light(new Vector2(j * 64, i * 64)); MapThings.Add(light); break; } case (int)GimmickType.STRAW: { Straw straw = new Straw(new Vector2(j * 64, i * 64)); MapThings.Add(straw); break; } case (int)GimmickType.COAL: { Coal coal = new Coal(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(coal); break; } case (int)GimmickType.GOAL: { Goal goal = new Goal(new Vector2(j * 64, i * 64), sound); MapThings.Add(goal); break; } case (int)GimmickType.WATER: { Water water = new Water(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(water); break; } case (int)GimmickType.WOOD: { Wood wood = new Wood(new Vector2(j * 64, i * 64)); MapThings.Add(wood); break; } case (int)GimmickType.TREE: { Tree tree = new Tree(new Vector2(j * 64, i * 64)); MapThings.Add(tree); break; } case (int)GimmickType.SAND: { Sand sand = new Sand(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(sand); break; } case (int)GimmickType.BALLOON: { Balloon balloon = new Balloon(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(balloon); break; } //葉梨竜太 case (int)GimmickType.HIGHLIGHT3: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2(j * 64, (i + 3) * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.SIDELIGHT3: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2((j + 3) * 64, i * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.HIGHLIGHT5: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2(j * 64, (i + 5) * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.SIDELIGHT5: { MoveLight moveLight = new MoveLight(new Vector2(j * 64, i * 64), new Vector2((j + 5) * 64, i * 64), Parameter.MoveLightSpeed); MapThings.Add(moveLight); break; } case (int)GimmickType.JSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.JSIGN); MapThings.Add(sign); break; } //葉梨竜太 11/30 case (int)GimmickType.BOMB: { Bomb bomb = new Bomb(new Vector2(j * 64, i * 64), sound, Vector2.Zero); MapThings.Add(bomb); break; } //葉梨竜太 case (int)GimmickType.IGNITER_UR: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_UR); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_UL: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_UL); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_DR: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_DR); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_DL: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_DL); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_HIGHT: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_HIGHT); MapThings.Add(igniter); break; } case (int)GimmickType.IGNITER_SIDE: { Igniter igniter = new Igniter(new Vector2(j * 64, i * 64), (int)GimmickType.IGNITER_SIDE); MapThings.Add(igniter); break; } //葉梨竜太 case (int)GimmickType.MSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.MSIGN); MapThings.Add(sign); break; } case (int)GimmickType.RSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.RSIGN); MapThings.Add(sign); break; } case (int)GimmickType.LSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.LSIGN); MapThings.Add(sign); break; } case (int)GimmickType.CSIGN: { Sign sign = new Sign(new Vector2(j * 64, i * 64), (int)GimmickType.CSIGN); MapThings.Add(sign); break; } // 1/13 葉梨竜太 case (int)GimmickType.ROCK: { Stone stone = new Stone(new Vector2(j * 64, i * 64)); MapThings.Add(stone); break; } } } } }
//by木材追加 長谷川修一 10/27 /// <summary> /// ギミック設置 /// </summary> /// <param name="mapdata">マップデータの二元配列</param> /// <param name="MapThings">マップ上の物のList</param> public static void CreateGimmicks(int[,] mapdata, List <GameObject> MapThings) { for (int i = 0; i < mapdata.GetLength(0); i++) { for (int j = 0; j < mapdata.GetLength(1); j++) { switch (mapdata[i, j]) { case (int)GimmickType.ICE: { Ice ice = new Ice(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(ice); break; } case (int)GimmickType.IRON: { Iron iron = new Iron(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(iron); break; } case (int)GimmickType.LIGHT: { Light light = new Light(new Vector2(j * 64, i * 64)); MapThings.Add(light); break; } case (int)GimmickType.STRAW: { Straw straw = new Straw(new Vector2(j * 64, i * 64)); MapThings.Add(straw); break; } case (int)GimmickType.COAL: { Coal coal = new Coal(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(coal); break; } case (int)GimmickType.GOAL: { Goal goal = new Goal(new Vector2(j * 64, i * 64)); MapThings.Add(goal); break; } case (int)GimmickType.WATER: { Water water = new Water(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(water); break; } case (int)GimmickType.WOOD: { Wood wood = new Wood(new Vector2(j * 64, i * 64)); MapThings.Add(wood); break; } case (int)GimmickType.TREE: { Tree tree = new Tree(new Vector2(j * 64, i * 64)); MapThings.Add(tree); break; } case (int)GimmickType.SAND: { Sand sand = new Sand(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(sand); break; } case (int)GimmickType.BALLOON: { Balloon balloon = new Balloon(new Vector2(j * 64, i * 64), Vector2.Zero); MapThings.Add(balloon); break; } } } } }