/// <summary> /// Generate Hex map with cells of 25cm X 25cm /// </summary> /// <param name="x"></param> /// <param name="y"></param> public HexMap(int x, int y) { //Set Offset Type for 2d -> 3d conversion OffsetType = OffsetTypes.OddRowsRight; Height = y; Width = x; UnclearedTerrain = new TerrainType(1, "uncleared"); ClearedTerrain = new TerrainType(2, "cleared"); DefaultMovement = new MovementType(1, "default"); var movementTypes = new MovementTypes( new ITerrainType[] { UnclearedTerrain, ClearedTerrain }, new Dictionary <IMovementType, Dictionary <ITerrainType, int> > { [DefaultMovement] = new Dictionary <ITerrainType, int> { [UnclearedTerrain] = 1, [ClearedTerrain] = 2 } } ); Graph = GraphFactory.CreateRectangularGraph(Width, Height, movementTypes, UnclearedTerrain); }
public void Constructor_ShouldThrow_WhenAddingTwoTypesWithTheSameId() { var ground = new TerrainType(1, "Ground"); var water = new TerrainType(2, "Water"); var walkingType = new MovementType(1, "Walking"); var swimmingType = new MovementType(1, "Swimming"); Assert.That(() => { var movementTypes = new MovementTypes(new[] { ground, water }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walkingType] = new Dictionary <TerrainType, int> { [ground] = 1, [water] = 2 }, [swimmingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1 } }); }, Throws.ArgumentException.With.Message.EqualTo( "Some of the movement types have same Ids. Ids: 1")); }
public static MovementState CreateMovementState(MovementTypes type, Vector3 hoz, Vector3 left) { MovementState toCreate = null; switch (type) { case MovementTypes.AI: throw new NotImplementedException(); break; case MovementTypes.Null: toCreate = new NullMove(); break; case MovementTypes.OneAxis: toCreate = new HorizontalAxisMove(DEFAULT_SPEED, hoz); break; case MovementTypes.TwoAxis: toCreate = new TwoAxisMove(DEFAULT_SPEED, hoz, left); break; default: //Only reached if a new type is added, but there is also no corresponding case throw new NotImplementedException(); } return(toCreate); }
public void GetAllTypes_ShouldReturnAllAddedTypes() { var ground = new TerrainType(1, "Ground"); var water = new TerrainType(2, "Water"); var walkingType = new MovementType(1, "Walking"); var swimmingType = new MovementType(2, "Swimming"); var movementTypes = new MovementTypes(new[] { ground, water }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walkingType] = new Dictionary <TerrainType, int> { [ground] = 1, [water] = 2 }, [swimmingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1 } }); Assert.That(movementTypes.GetAllMovementTypes(), Is.EquivalentTo(new[] { walkingType, swimmingType })); Assert.That(movementTypes.GetAllTerrainTypes(), Is.EquivalentTo(new[] { ground, water })); }
public override void ExecuteEdit() { FormTitle = "Salida " + SelectedGoodsIssues.DocNum.ToString(); GoodsIssuesDetails = new ObservableCollection <IGE1_GoodsIssueDetail>(SelectedGoodsIssues.IGE1_GoodsIssueDetail); IsEnabled = GoodsIssuesDetails.Count == 0; if (!string.IsNullOrEmpty(SelectedGoodsIssues.IdMovement)) { SelectedMovement = MovementTypes.First(m => m.Code == SelectedGoodsIssues.IdMovement); } if (SelectedGoodsIssues.ItmsGrpCod.HasValue) { SelectedGroup = Groups.FirstOrDefault(g => g.ItmsGrpCod == SelectedGoodsIssues.ItmsGrpCod); } // actualizar inventario actual. var inventory = ArticlesHelper.GetArticlesFor(SelectedGoodsIssues.IGE1_GoodsIssueDetail.Select(p => p.ItemCode).ToList()); GoodsIssuesDetails.ToList().ForEach(d => { var product = inventory.FirstOrDefault(p => p.ItemCode == d.ItemCode); if (product != null && product.OnHand1.HasValue) { d.OnHand = product.OnHand1.Value; } //GetOnHandFromProduct(product); }); ShowDialog(new GoodIssuesView(), this); }
public void Constructor_ShouldThrowIfAnEmptyDictionaryIsPassed() { var ground = new TerrainType(1, "Ground"); var walking = new MovementType(1, "Walking"); Assert.That(() => { var movementTypes = new MovementTypes(new[] { ground }, new Dictionary <MovementType, Dictionary <TerrainType, int> >()); }, Throws.ArgumentException.With.Message.EqualTo( "Movement types should always have at least one explicitly defined type. For the reasoning, please visit the movement types section in the library's docs")); Assert.That(() => { var movementTypes = new MovementTypes(new TerrainType[] { }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walking] = new Dictionary <TerrainType, int> { [ground] = 1 } }); }, Throws.ArgumentException.With.Message.EqualTo( "Error when adding movement type 'Walking': movement costs contain unknown type: 'Ground'")); }
public void Constructor_ShouldThrow_WhenAddingATypeWithIncompleteCosts() { var ground = new TerrainType(1, "Ground"); var water = new TerrainType(2, "Water"); var air = new TerrainType(3, "Air"); var walkingType = new MovementType(1, "Walking"); var swimmingType = new MovementType(2, "Swimming"); var flyingType = new MovementType(3, "Flying"); Assert.That(() => { var movementTypes = new MovementTypes(new[] { ground, water, air }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walkingType] = new Dictionary <TerrainType, int> { [ground] = 1 }, [swimmingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1 }, [flyingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1 } }); }, Throws.ArgumentException.With.Message.EqualTo( "Error when adding movement type 'Walking': missing movement costs to types: 'Water', 'Air'")); }
public static MovementTypes GetMovementTypes() { TerrainType[] terrainTypes = { Ground, Water, Air }; var movementTypes = new MovementTypes(terrainTypes, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [Walking] = new Dictionary <TerrainType, int> { [Ground] = 1, [Water] = 2, [Air] = 999 }, [Swimming] = new Dictionary <TerrainType, int> { [Ground] = 2, [Water] = 1, [Air] = 999 }, [Flying] = new Dictionary <TerrainType, int> { [Ground] = 1, [Water] = 1, [Air] = 1 } }); return(movementTypes); }
private bool CanCreatureMove(MovementTypes movementType, Direction direction, TilePointLayer to) { if (to.Movement == MovementTypes.Walk) { return(true); } if (to.Movement == MovementTypes.Blocked) { return(false); } if (direction == Direction.East && to.Movement.HasFlag(MovementTypes.BlockedWest)) { return(false); } if (direction == Direction.West && to.Movement.HasFlag(MovementTypes.BlockedEast)) { return(false); } if (direction == Direction.North && to.Movement.HasFlag(MovementTypes.BlockedSouth)) { return(false); } if (direction == Direction.South && to.Movement.HasFlag(MovementTypes.BlockedNorth)) { return(false); } if (!to.Movement.HasFlag(movementType)) { return(false); } return(true); }
public void GetType_ShouldReturnTypeByTheId() { var ground = new TerrainType(1, "Ground"); var water = new TerrainType(2, "Water"); var walkingType = new MovementType(1, "Walking"); var swimmingType = new MovementType(123, "Swimming"); var movementTypes = new MovementTypes(new[] { ground, water }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walkingType] = new Dictionary <TerrainType, int> { [ground] = 1, [water] = 2 }, [swimmingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1 } }); Assert.That(movementTypes.GetMovementTypeById(1), Is.EqualTo(walkingType)); Assert.That(movementTypes.GetMovementTypeById(123), Is.EqualTo(swimmingType)); }
public void AddShapeToList(ASCII_Shape shape, MovementTypes movementType, int linearDistance = 0) { switch (movementType) { case MovementTypes.Up_Down: shape.Add_Movement(new Movements.Up_Down(linearDistance)); break; case MovementTypes.Left_Right: shape.Add_Movement(new Movements.Left_Right(linearDistance)); break; case MovementTypes.Diagonal_BL_TR: shape.Add_Movement(new Movements.Diagonal_BL_TR(linearDistance)); break; case MovementTypes.Circle_CW: shape.Add_Movement(new Movements.Circle_CW()); break; case MovementTypes.Circle_CCW: shape.Add_Movement(new Movements.Circle_CCW()); break; case MovementTypes.Spiral_CW: shape.Add_Movement(new Movements.Spiral_CW()); break; } }
public void Constructor_ShouldThrow_WhenAddingATypeWithCostsOutsideOfKnownTypes() { var ground = new TerrainType(1, "Ground"); var water = new TerrainType(2, "Water"); var air = new TerrainType(3, "Air"); var walkingType = new MovementType(1, "Walking"); var swimmingType = new MovementType(2, "Swimming"); Assert.That(() => { var movementTypes = new MovementTypes(new[] { ground, water }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walkingType] = new Dictionary <TerrainType, int> { [ground] = 1, [water] = 2, [air] = 1 }, [swimmingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1, [air] = 1 } }); }, Throws.ArgumentException.With.Message.EqualTo( "Error when adding movement type 'Walking': movement costs contain unknown type: 'Air'")); }
public void OnButtonPress(string buttonString) { //EventSystem.current.SetSelectedGameObject(null); StartCoroutine(DeactivateMovements()); switch (buttonString) { case "None": currentMovementType = MovementTypes.None; EventSystem.current.SetSelectedGameObject(movementButtonNone); // All done! break; case "StraightPointer": currentMovementType = MovementTypes.StraightPointer; EventSystem.current.SetSelectedGameObject(movementButtonStraightPointer); VRTK_BasePointerRenderer straightRenderer = VRTK.VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_StraightPointerRenderer> (); VRTK.VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_Pointer> ().pointerRenderer = straightRenderer; break; case "BezierPointer": currentMovementType = MovementTypes.BezierPointer; EventSystem.current.SetSelectedGameObject(movementButtonBezierPointer); VRTK_BasePointerRenderer bezierRenderer = VRTK.VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_BezierPointerRenderer> (); VRTK.VRTK_DeviceFinder.GetControllerRightHand().GetComponent <VRTK_Pointer> ().pointerRenderer = bezierRenderer; break; case "RemoteBeam": currentMovementType = MovementTypes.RemoteBeam; EventSystem.current.SetSelectedGameObject(movementButtonRemoteBeam); // Just need to reactivate the beam. GameObject.Find("/RemoteBeam").transform.GetChild(0).gameObject.SetActive(true); break; } }
public void CellStateExample_ShouldWork() { var ground = new TerrainType(1, "Ground"); var water = new TerrainType(2, "Water"); var walkingType = new MovementType(1, "Walking"); var swimmingType = new MovementType(2, "Swimming"); var movementTypes = new MovementTypes( new[] { ground, water }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walkingType] = new Dictionary <TerrainType, int> { [ground] = 1, [water] = 2 }, [swimmingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1 } } ); var graph = new Graph(new List <CellState> { new CellState(false, new Coordinate2D(0, 0, OffsetTypes.OddRowsRight), ground), new CellState(false, new Coordinate2D(0, 1, OffsetTypes.OddRowsRight), ground), new CellState(true, new Coordinate2D(1, 0, OffsetTypes.OddRowsRight), water), new CellState(false, new Coordinate2D(1, 1, OffsetTypes.OddRowsRight), water), new CellState(false, new Coordinate2D(1, 2, OffsetTypes.OddRowsRight), ground) }, movementTypes); }
//For SmoothDamp only; higher speed = slower movement private IEnumerator MoveAsset(GameObject prefab, Vector2 target, float speed, MovementTypes style) { isMoving = true; movingPrefab = prefab; targetPosition = target; Vector2 currentPosition = prefab.transform.position; Vector2 velocity = Vector2.zero; speed *= Time.deltaTime; while (Mathf.RoundToInt(Vector2.Distance(currentPosition, target)) > 0) { currentPosition = style switch { MovementTypes.Smooth => Vector2.MoveTowards(currentPosition, target, speed * 50), MovementTypes.FastStart => Vector2.Lerp(currentPosition, target, speed), MovementTypes.FastMiddle => Vector2.SmoothDamp(currentPosition, target, ref velocity, speed * 10), _ => currentPosition }; PlaceAt(prefab, currentPosition); yield return(new WaitForSeconds(.001f)); } PlaceAt(prefab, targetPosition); isMoving = false; }
} // end method WaypointEngine // @author: Craig Broskow, created skeleton IEnumerator RunMovement(MovementTypes wp) { switch (wp.moveType) { case MovementType.BEZIERCURVE: StartCoroutine(MoveBezierCurve(wp.waypointDuration, wp.point1.transform.position, wp.point2.transform.position, wp.point3.transform.position)); yield return(new WaitForSeconds(wp.waypointDuration)); break; case MovementType.LOOKANDRETURN: break; case MovementType.STRAIGHTLINE: StartCoroutine(MoveStraightLine(wp.waypointDuration, wp.point1.position, wp.point2.position)); yield return(new WaitForSeconds(wp.waypointDuration)); break; case MovementType.WAIT: yield return(new WaitForSeconds(wp.waypointDuration)); break; default: Debug.Log("Invalid movement type!"); break; } // end switch yield return(null); } // end method RunMovement
// @author: Craig Broskow, created skeleton to test concurrent running // Modified for actual facing code by: Nathan Boehning IEnumerator RunFacing(MovementTypes wp) { // If the movement type is look and return, no facing type will occur if (wp.moveType == MovementType.LOOKANDRETURN) { yield return(new WaitForSeconds(wp.waypointDuration)); } else { switch (wp.facingType) { case FacingTypes.FIXEDPOINT: StartCoroutine(FacingFixedPoint(wp.waypointDuration, wp.lookPoint)); yield return(new WaitForSeconds(wp.waypointDuration)); break; case FacingTypes.FREELOOK: StartCoroutine(FacingFreeLook(wp.waypointDuration)); yield return(new WaitForSeconds(wp.waypointDuration)); // Make cursor visible and able to move again Cursor.lockState = CursorLockMode.None; Cursor.visible = true; break; default: Debug.Log("Invalid facing type!"); break; } // end switch yield return(null); } } // end method RunFacing
} // end method FaceFreeLook // @author: Craig Broskow IEnumerator RunCameraEffect(MovementTypes wp) { switch (wp.effectType) // check for camera effects { case CameraEffectTypes.SHAKE: StartCoroutine(ShakeCamera(wp.effectDuration, wp.shakeIntensity)); yield return(new WaitForSeconds(wp.effectDuration)); break; case CameraEffectTypes.FADE: StartCoroutine(FadeCamera(wp.effectDuration, wp.isFadedOut)); yield return(new WaitForSeconds(wp.effectDuration)); break; case CameraEffectTypes.SPLATTER: StartCoroutine(SplatterCamera(wp.effectDuration, wp.splatterFade, wp.fadeTime)); yield return(new WaitForSeconds(wp.effectDuration)); break; case CameraEffectTypes.NONE: yield return(new WaitForSeconds(wp.effectDuration)); break; default: Debug.Log("Invalid camera effect!"); break; } // end switch yield return(null); } // end method RunCameraEffect
public void TerrainMovementTypeExample_ShouldWork() { var ground = new TerrainType(1, "Ground"); var water = new TerrainType(2, "Water"); var walkingType = new MovementType(1, "Walking"); var swimmingType = new MovementType(2, "Swimming"); var movementTypes = new MovementTypes( new[] { ground, water }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walkingType] = new Dictionary <TerrainType, int> { [ground] = 1, [water] = 2 }, [swimmingType] = new Dictionary <TerrainType, int> { [ground] = 2, [water] = 1 } } ); }
private void move(MovementTypes type) { var multiplier = this.getMultiplier(type); var translationAmount = multiplier * Time.deltaTime; var translationVector = new Vector3(0, translationAmount, 0); transform.Translate(translationVector); }
void Awake() { if(modelMesh == null) modelMesh = this.gameObject; startHealth = health; sensor = this.GetComponent<Detector>(); movType = this.gameObject.AddComponent<MovementTypes>(); }
public PrinterMachineInstruction(string Line, PrinterMachineInstruction copy) : this(Line) { xyzPosition = copy.xyzPosition; feedRate = copy.feedRate; ePosition = copy.ePosition; movementType = copy.movementType; secondsToEndFromHere = copy.secondsToEndFromHere; ExtruderIndex = copy.ExtruderIndex; }
public PrinterMachineInstruction(string Line, PrinterMachineInstruction copy, bool clientInsertion = false) : this(Line) { xyzPosition = copy.xyzPosition; FeedRate = copy.FeedRate; EPosition = copy.EPosition; MovementType = copy.MovementType; SecondsToEndFromHere = copy.SecondsToEndFromHere; ToolIndex = copy.ToolIndex; }
CameraMovementComponent(CameraState state, MovementData movementData, MovementTypes movementType, int delta, float speedValue) : this() { Tag = ElementTag.New(); IsValid = true; State = state; MovementData = movementData; MovementType = movementType; Delta = delta; SpeedValue = speedValue; }
public PrinterMachineInstruction(string Line, PrinterMachineInstruction copy, bool clientInsertion = false) : this(Line) { xyzPosition = copy.xyzPosition; feedRate = copy.feedRate; ePosition = copy.ePosition; movementType = copy.movementType; secondsToEndFromHere = copy.secondsToEndFromHere; ExtruderIndex = copy.ExtruderIndex; this.clientInsertion = clientInsertion; }
// Set the object to copy the position public void MoveCopy(GameObject target) { // Save the target this.targetToCopy = target; // Save the offset this.xOffset = target.transform.position.x - transform.position.x; this.yOffset = target.transform.position.y - transform.position.y; // Change the mode this.mode = MovementTypes.COPY; }
}//End UpdateMovementSpeeds Method - overload for All MoveTypes to change public void UpdateMovementSpeeds(MovementTypes MoveType, float floChange) { switch (MoveType) { case MovementTypes.Forward: RFPC.movementSettings.ForwardSpeed += floChange; break; case MovementTypes.Backward: RFPC.movementSettings.BackwardSpeed += floChange; break; case MovementTypes.Strafe: RFPC.movementSettings.StrafeSpeed += floChange; break; case MovementTypes.Multiplier: RFPC.movementSettings.RunMultiplier += floChange; break; } }//End UpdateMovementSpeeds Method - overload for One MoveType change
private Globals() { _random = new Random(); GameWorld = GameWorld.Create(); MovementTypes = MovementTypes.Create(new List <MovementType> { MovementType.Create(1, "Ground") }); TerrainTypes = TerrainTypes.Create(TerrainTypesLoader.GetTerrainTypes()); MineralTypes = MineralTypes.Create(MineralTypesLoader.GetMineralTypes()); UnitTypes = UnitTypes.Create(UnitTypesLoader.GetUnitTypes(MovementTypes)); RaceTypes = RaceTypes.Create(RaceTypesLoader.GetRaceTypes()); BuildingTypes = BuildingTypesLoader.GetBuildingTypes(); }
private float getMultiplier(MovementTypes type) { switch (type) { case MovementTypes.Forward: return(this.speed); case MovementTypes.Backward: return(-this.speed); default: return(0); } }
public GameMessageMotion(WorldObject animationTarget, Session session, MotionAutonomous activity, MovementTypes type, MotionFlags flags, MotionStance stance, MovementData movement, List <MotionItem> animations = null) : this() { WriteBase(animationTarget, session, activity, type, flags, stance); movement?.Serialize(this.Writer); if (animations == null) { this.Writer.Write((ushort)0); } else { this.WriteAnimations(animationTarget, animations); } }
public void Constructor_ShouldAddNewType() { var ground = new TerrainType(1, "Ground"); var walking = new MovementType(1, "Walking"); var movementTypes = new MovementTypes(new[] { ground }, new Dictionary <MovementType, Dictionary <TerrainType, int> > { [walking] = new Dictionary <TerrainType, int> { [ground] = 1 } }); Assert.That(movementTypes.ContainsTerrainType(ground), Is.True); Assert.That(movementTypes.ContainsMovementType(walking), Is.True); }
}//End enum MovementType public float GetMoveSpd(MovementTypes MoveType) { float floResult = 0f; switch (MoveType) { case MovementTypes.Forward: floResult = RFPC.movementSettings.ForwardSpeed; break; case MovementTypes.Backward: floResult = RFPC.movementSettings.BackwardSpeed; break; case MovementTypes.Strafe: floResult = RFPC.movementSettings.StrafeSpeed; break; case MovementTypes.Multiplier: floResult = RFPC.movementSettings.RunMultiplier; break; } return(floResult); }//End GetMovementSpeed Method
public Data_Class() { Id = 0; Name = ""; Class_Types = new List <ClassTypes>(); Skills = new List <Data_Class_Skill>(); Description = ""; Caps = new List <int>[] { new List <int>(GENERIC_CAPS), new List <int>(GENERIC_CAPS) }; Max_WLvl = new List <int> { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Promotion = new Dictionary <int, List <int>[]>(); Mov = 5; Mov_Cap = 15; Movement_Type = MovementTypes.Light; Generic_Stats = new List <List <int>[]> { new List <int>[2] { new List <int> { 0, 0, 0, 0, 0, 0, 0, 0 }, new List <int> { 0, 0, 0, 0, 0, 0, 0 } }, new List <int>[2] { new List <int> { 0, 0, 0, 0, 0, 0, 0, 0 }, new List <int> { 0, 0, 0, 0, 0, 0, 0 } }, new List <int>[2] { new List <int> { 0, 0, 0, 0, 0, 0, 0, 0 }, new List <int> { 0, 0, 0, 0, 0, 0, 0 } }, new List <int>[2] { new List <int> { 0, 0, 0, 0, 0, 0, 0, 0 }, new List <int> { 0, 0, 0, 0, 0, 0, 0 } } }; }
// Move the object relative at parent public void MoveLocal() { // Get the renderer Renderer renderer = this.GetComponent<Renderer>(); // Fix the bounds Bounds bounds = renderer.bounds; bounds.center = Vector2.zero; // Assign this.bmv.SetBounds(bounds); // Create the first path this.bmv.SetStartPosition(transform.position); this.bmv.AddDestination(); this.bmv.AddDestination(); // Reset the mode this.mode = MovementTypes.LOCAL; }
// Stop copy position public void Stop() { // Stop the movement this.rigidBody.velocity = Vector2.zero; // Reset the mode this.mode = MovementTypes.NONE; }
// @author: Craig Broskow public bool LoadUGCFile(ref MovementTypes[] waypointObjects) { char[] delimiterChars = { ' ', '=' }; try { if (!sourceFile.Exists) { return false; } if (sourceFile != null && sourceFile.Exists) reader = sourceFile.OpenText(); if (reader == null) { Debug.Log ("UGC stream reader is null!"); return false; } else { inputLines = new string[100]; int lineNumber = 0; int lineCount = 0; while (((lineNumber < 100) && (inputLines[lineNumber] = reader.ReadLine()) != null)) { lineNumber++; lineCount++; } reader.Close(); waypointObjects = new MovementTypes[lineCount]; MovementTypes wp; // create a waypoint object pointer to use in the for loop for (int i = 0; i < lineCount; i++) { waypointObjects[i] = new MovementTypes(); wp = waypointObjects[i]; // point wp to the current waypoint string[] paramArray = inputLines[i].Split(delimiterChars); for (int j = 0; j < paramArray.Length - 1; j = j + 2) { switch (paramArray[j]) { case "DT": wp.fadeTime = Convert.ToSingle(paramArray[j+1]); break; case "ED": wp.effectDuration = Convert.ToSingle(paramArray[j+1]); break; case "EL": wp.effectDelay = Convert.ToSingle(paramArray[j+1]); break; case "ET": switch (Convert.ToInt32(paramArray[j+1])) { case 0: wp.effectType = CameraEffectTypes.SPLATTER; break; case 1: wp.effectType = CameraEffectTypes.SHAKE; break; case 2: wp.effectType = CameraEffectTypes.FADE; break; default: wp.effectType = CameraEffectTypes.NONE; break; } break; case "FT": wp.facingType = Convert.ToInt32(paramArray[j+1]) == 0 ? FacingTypes.FREELOOK : FacingTypes.FIXEDPOINT; break; case "IF": wp.isFadedOut = Convert.ToInt32(paramArray[j+1]) == 0 ? false : true; break; case "L1": wp.lookTime1 = Convert.ToSingle(paramArray[j+1]); break; case "L2": wp.lookTime2 = Convert.ToSingle(paramArray[j+1]); break; case "L3": wp.lookTime3 = Convert.ToSingle(paramArray[j+1]); break; case "LP": string[] LPArray = paramArray[j+1].Split(','); GameObject goLP = new GameObject(); goLP.transform.position = new Vector3(Convert.ToSingle(LPArray[0]), Convert.ToSingle(LPArray[1]), Convert.ToSingle(LPArray[2])); wp.lookPoint = goLP.transform; break; case "MT": switch (Convert.ToInt32(paramArray[j+1])) { case 0: wp.moveType = MovementType.STRAIGHTLINE; break; case 1: wp.moveType = MovementType.BEZIERCURVE; break; case 2: wp.moveType = MovementType.LOOKANDRETURN; break; default: wp.moveType = MovementType.WAIT; break; } break; case "P1": string[] P1Array = paramArray[j+1].Split(','); GameObject goP1 = new GameObject(); goP1.transform.position = new Vector3(Convert.ToSingle(P1Array[0]), Convert.ToSingle(P1Array[1]), Convert.ToSingle(P1Array[2])); wp.point1 = goP1.transform; break; case "P2": string[] P2Array = paramArray[j+1].Split(','); GameObject goP2 = new GameObject(); goP2.transform.position = new Vector3(Convert.ToSingle(P2Array[0]), Convert.ToSingle(P2Array[1]), Convert.ToSingle(P2Array[2])); wp.point2 = goP2.transform; break; case "P3": string[] P3Array = paramArray[j+1].Split(','); GameObject goP3 = new GameObject(); goP3.transform.position = new Vector3(Convert.ToSingle(P3Array[0]), Convert.ToSingle(P3Array[1]), Convert.ToSingle(P3Array[2])); wp.point3 = goP3.transform; break; case "SF": wp.splatterFade = Convert.ToInt32(paramArray[j+1]) == 0 ? false : true; break; case "SI": wp.shakeIntensity = Convert.ToSingle(paramArray[j+1]); break; case "WD": wp.waypointDuration = Convert.ToSingle(paramArray[j+1]); break; default: Debug.Log ("UGC file contains an invalid parameter: " + paramArray[j]); return false; break; } } } } return true; } catch (Exception e) { Debug.Log("ReadUGC.loadUGCFile() threw an exception!"); Debug.Log("Exception Message: " + e.Message); return false; } }
public void SetMovementType(int type) { mType = (MovementTypes)type; setStrings (); }
// @author: Craig Broskow, created skeleton IEnumerator RunMovement(MovementTypes wp) { switch(wp.moveType) { case MovementType.BEZIERCURVE: StartCoroutine(MoveBezierCurve(wp.waypointDuration, wp.point1.transform.position, wp.point2.transform.position, wp.point3.transform.position)); yield return new WaitForSeconds(wp.waypointDuration); break; case MovementType.LOOKANDRETURN: break; case MovementType.STRAIGHTLINE: StartCoroutine(MoveStraightLine(wp.waypointDuration, wp.point1.position, wp.point2.position)); yield return new WaitForSeconds(wp.waypointDuration); break; case MovementType.WAIT: yield return new WaitForSeconds(wp.waypointDuration); break; default: Debug.Log ("Invalid movement type!"); break; } // end switch yield return null; }
// @author: Craig Broskow, created skeleton to test concurrent running // Modified for actual facing code by: Nathan Boehning IEnumerator RunFacing(MovementTypes wp) { // If the movement type is look and return, no facing type will occur if (wp.moveType == MovementType.LOOKANDRETURN) { yield return new WaitForSeconds(wp.waypointDuration); } else { switch (wp.facingType) { case FacingTypes.FIXEDPOINT: StartCoroutine(FacingFixedPoint(wp.waypointDuration, wp.lookPoint)); yield return new WaitForSeconds(wp.waypointDuration); break; case FacingTypes.FREELOOK: StartCoroutine(FacingFreeLook(wp.waypointDuration)); yield return new WaitForSeconds(wp.waypointDuration); // Make cursor visible and able to move again Cursor.lockState = CursorLockMode.None; Cursor.visible = true; break; default: Debug.Log("Invalid facing type!"); break; } // end switch yield return null; } }
// @author: Craig Broskow IEnumerator RunCameraEffect(MovementTypes wp) { switch(wp.effectType) // check for camera effects { case CameraEffectTypes.SHAKE: StartCoroutine(ShakeCamera(wp.effectDuration, wp.shakeIntensity)); yield return new WaitForSeconds(wp.effectDuration); break; case CameraEffectTypes.FADE: StartCoroutine(FadeCamera(wp.effectDuration, wp.isFadedOut)); yield return new WaitForSeconds(wp.effectDuration); break; case CameraEffectTypes.SPLATTER: StartCoroutine(SplatterCamera(wp.effectDuration, wp.splatterFade, wp.fadeTime)); yield return new WaitForSeconds(wp.effectDuration); break; case CameraEffectTypes.NONE: yield return new WaitForSeconds(wp.effectDuration); break; default: Debug.Log ("Invalid camera effect!"); break; } // end switch yield return null; }
public MovementTypeAndCost(MovementTypes type, float cost) { Type = type; Cost = cost; }
// ------------------------------------- // Public methods // Start the random movement public void MoveRandom() { // Reset the bounds this.bmv.SetBounds(new Bounds()); // Create the first path this.bmv.SetStartPosition(transform.position); this.bmv.AddDestination(); // Reset the mode this.mode = MovementTypes.RANDOM; }