override public void ShowGUI(List <ActionParameter> parameters) { invAction = (InvAction)EditorGUILayout.EnumPopup("Method:", invAction); string _label = "Object to instantiate:"; if (invAction == InvAction.Remove) { _label = "Object to delete:"; } parameterID = Action.ChooseParameterGUI(_label, parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; gameObject = null; } else { gameObject = (GameObject)EditorGUILayout.ObjectField(_label, gameObject, typeof(GameObject), true); constantID = FieldToID(gameObject, constantID); gameObject = IDToField(gameObject, constantID, false); } if (invAction == InvAction.Add) { positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo); } AfterRunningOption(); }
public static Vector2 GetScreenPosition(Direction dir, Vector2 offset, PositionRelativeTo m) { int mov = (int)m; float width = offset.x; float height = offset.y; if (dir.HasFlag(Direction.North)) { height = GetScreenHeight() / 2 - (mov * offset.y); } else if (dir.HasFlag(Direction.South)) { height = -GetScreenHeight() / 2 + (mov * offset.y); } if (dir.HasFlag(Direction.East)) { width = GetScreenWidth() / 2 - (mov * offset.x); } else if (dir.HasFlag(Direction.West)) { width = -GetScreenWidth() / 2 + (mov * offset.x); } return(new Vector2(width, height)); }
public void SetToTransform(Transform transform, Vector2 offset) { Location = PositionLocation.Transform; PositionOffset = offset; RelativeTo = PositionRelativeTo.None; PositionRefrence = transform; }
public void SetToPosition(Direction d, Vector2 offset, PositionRelativeTo r = PositionRelativeTo.None) { Location = PositionLocation.Direction; Direction = d; PositionOffset = offset; RelativeTo = r; PositionRefrence = null; }
override public void ShowGUI(List <ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer); if (!isPlayer) { obToMoveParameterID = Action.ChooseParameterGUI("Object to move:", parameters, obToMoveParameterID, ParameterType.GameObject); if (obToMoveParameterID >= 0) { obToMoveID = 0; obToMove = null; } else { obToMove = (GameObject)EditorGUILayout.ObjectField("Object to move:", obToMove, typeof(GameObject), true); obToMoveID = FieldToID(obToMove, obToMoveID); obToMove = IDToField(obToMove, obToMoveID, false); } } markerParameterID = Action.ChooseParameterGUI("Teleport to:", parameters, markerParameterID, ParameterType.GameObject); if (markerParameterID >= 0) { markerID = 0; teleporter = null; } else { teleporter = (Marker)EditorGUILayout.ObjectField("Teleport to:", teleporter, typeof(Marker), true); markerID = FieldToID <Marker> (teleporter, markerID); teleporter = IDToField <Marker> (teleporter, markerID, false); } positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo); copyRotation = EditorGUILayout.Toggle("Copy rotation?", copyRotation); if (isPlayer) { snapCamera = EditorGUILayout.Toggle("Teleport active camera too?", snapCamera); } if (isPlayer || (obToMove != null && obToMove.GetComponent <Char>())) { recalculateActivePathFind = EditorGUILayout.Toggle("Recalculate pathfinding?", recalculateActivePathFind); } AfterRunningOption(); }
public void CopyValues(PositionProvider source) { Location = source.Location; Direction = source.Direction; PositionOffset = source.PositionOffset; RandomMultitude = source.RandomMultitude; RandomPositionOption = source.RandomPositionOption; RandomTransforms = source.RandomTransforms.ToArray(); Degree = source.Degree; RelativeTo = source.RelativeTo; RotationFacing = source.RotationFacing; PositionRefrence = source.PositionRefrence; RotationRefrence = source.RotationRefrence; RotationOffset = source.RotationOffset; RotationOffsetType = source.RotationOffsetType; RotationOffsetVector = source.RotationOffsetVector; RotationRandomOffset = source.RotationRandomOffset; }
override public void ShowGUI(List <ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer); if (!isPlayer) { obToMoveParameterID = Action.ChooseParameterGUI("Object to move:", parameters, obToMoveParameterID, ParameterType.GameObject); if (obToMoveParameterID >= 0) { obToMoveID = 0; obToMove = null; } else { obToMove = (GameObject)EditorGUILayout.ObjectField("Object to move:", obToMove, typeof(GameObject), true); obToMoveID = FieldToID(obToMove, obToMoveID); obToMove = IDToField(obToMove, obToMoveID, false); } } markerParameterID = Action.ChooseParameterGUI("Teleport to:", parameters, markerParameterID, ParameterType.GameObject); if (markerParameterID >= 0) { markerID = 0; teleporter = null; } else { teleporter = (Marker)EditorGUILayout.ObjectField("Teleport to:", teleporter, typeof(Marker), true); markerID = FieldToID <Marker> (teleporter, markerID); teleporter = IDToField <Marker> (teleporter, markerID, false); } positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo); copyRotation = EditorGUILayout.Toggle("Copy rotation?", copyRotation); AfterRunningOption(); }
override public void ShowGUI(List <ActionParameter> parameters) { invAction = (InvAction)EditorGUILayout.EnumPopup("Method:", invAction); string _label = "Object to instantiate:"; if (invAction == InvAction.Remove) { _label = "Object to delete:"; } parameterID = Action.ChooseParameterGUI(_label, parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; gameObject = null; } else { gameObject = (GameObject)EditorGUILayout.ObjectField(_label, gameObject, typeof(GameObject), true); constantID = FieldToID(gameObject, constantID); gameObject = IDToField(gameObject, constantID, false); } if (invAction == InvAction.Add) { positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo); if (positionRelativeTo == PositionRelativeTo.RelativeToGameObject) { relativeGameObjectParameterID = Action.ChooseParameterGUI("Relative GameObject:", parameters, relativeGameObjectParameterID, ParameterType.GameObject); if (relativeGameObjectParameterID >= 0) { relativeGameObjectID = 0; relativeGameObject = null; } else { relativeGameObject = (GameObject)EditorGUILayout.ObjectField("Relative GameObject:", relativeGameObject, typeof(GameObject), true); relativeGameObjectID = FieldToID(relativeGameObject, relativeGameObjectID); relativeGameObject = IDToField(relativeGameObject, relativeGameObjectID, false); } } else if (positionRelativeTo == PositionRelativeTo.EnteredValue) { relativeVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, relativeVectorParameterID, ParameterType.Vector3); if (relativeVectorParameterID < 0) { relativeVector = EditorGUILayout.Vector3Field("Value:", relativeVector); } } else if (positionRelativeTo == PositionRelativeTo.VectorVariable) { if (isAssetFile) { variableLocation = VariableLocation.Global; } else { variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation); } if (variableLocation == VariableLocation.Global) { vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } } else if (variableLocation == VariableLocation.Local) { vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } } } } else if (invAction == InvAction.Replace) { EditorGUILayout.Space(); replaceParameterID = Action.ChooseParameterGUI("Object to delete:", parameters, replaceParameterID, ParameterType.GameObject); if (replaceParameterID >= 0) { replaceConstantID = 0; replaceGameObject = null; } else { replaceGameObject = (GameObject)EditorGUILayout.ObjectField("Object to delete:", replaceGameObject, typeof(GameObject), true); replaceConstantID = FieldToID(replaceGameObject, replaceConstantID); replaceGameObject = IDToField(replaceGameObject, replaceConstantID, false); } } AfterRunningOption(); }
public override void ShowGUI(List<ActionParameter> parameters) { invAction = (InvAction) EditorGUILayout.EnumPopup ("Method:", invAction); string _label = "Object to instantiate:"; if (invAction == InvAction.Remove) { _label = "Object to delete:"; } parameterID = Action.ChooseParameterGUI (_label, parameters, parameterID, ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; gameObject = null; } else { gameObject = (GameObject) EditorGUILayout.ObjectField (_label, gameObject, typeof (GameObject), true); constantID = FieldToID (gameObject, constantID); gameObject = IDToField (gameObject, constantID, false); } if (invAction == InvAction.Add) { positionRelativeTo = (PositionRelativeTo) EditorGUILayout.EnumPopup ("Position relative to:", positionRelativeTo); } else if (invAction == InvAction.Replace) { EditorGUILayout.Space (); replaceParameterID = Action.ChooseParameterGUI ("Object to delete:", parameters, replaceParameterID, ParameterType.GameObject); if (replaceParameterID >= 0) { replaceConstantID = 0; replaceGameObject = null; } else { replaceGameObject = (GameObject) EditorGUILayout.ObjectField ("Object to delete:", replaceGameObject, typeof (GameObject), true); replaceConstantID = FieldToID (replaceGameObject, replaceConstantID); replaceGameObject = IDToField (replaceGameObject, replaceConstantID, false); } } AfterRunningOption (); }
public override void ShowGUI(List <ActionParameter> parameters) { invAction = (InvAction)EditorGUILayout.EnumPopup("Method:", invAction); string _label = "Object to instantiate:"; if (invAction == InvAction.Remove) { _label = "Object to delete:"; } ParameterType[] parameterTypes = new ParameterType[2] { ParameterType.GameObject, ParameterType.InventoryItem }; parameterID = Action.ChooseParameterGUI(_label, parameters, parameterID, parameterTypes); if (parameterID >= 0) { constantID = 0; gameObject = null; } else { gameObject = (GameObject)EditorGUILayout.ObjectField(_label, gameObject, typeof(GameObject), true); constantID = FieldToID(gameObject, constantID); gameObject = IDToField(gameObject, constantID, false); } if (invAction == InvAction.Add) { positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo); if (positionRelativeTo == PositionRelativeTo.RelativeToGameObject) { relativeGameObjectParameterID = Action.ChooseParameterGUI("Relative GameObject:", parameters, relativeGameObjectParameterID, ParameterType.GameObject); if (relativeGameObjectParameterID >= 0) { relativeGameObjectID = 0; relativeGameObject = null; } else { relativeGameObject = (GameObject)EditorGUILayout.ObjectField("Relative GameObject:", relativeGameObject, typeof(GameObject), true); relativeGameObjectID = FieldToID(relativeGameObject, relativeGameObjectID); relativeGameObject = IDToField(relativeGameObject, relativeGameObjectID, false); } } else if (positionRelativeTo == PositionRelativeTo.EnteredValue) { relativeVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, relativeVectorParameterID, ParameterType.Vector3); if (relativeVectorParameterID < 0) { relativeVector = EditorGUILayout.Vector3Field("Value:", relativeVector); } } else if (positionRelativeTo == PositionRelativeTo.VectorVariable) { variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation); switch (variableLocation) { case VariableLocation.Global: vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } break; case VariableLocation.Local: if (!isAssetFile) { vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } } else { EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info); } break; case VariableLocation.Component: vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.ComponentVariable); if (vectorVarParameterID >= 0) { variables = null; variablesConstantID = 0; } else { variables = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true); variablesConstantID = FieldToID <Variables> (variables, variablesConstantID); variables = IDToField <Variables> (variables, variablesConstantID, false); if (variables != null) { vectorVarID = AdvGame.ComponentVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3, variables); } } break; } } spawnedObjectParameterID = ChooseParameterGUI("Send to parameter:", parameters, spawnedObjectParameterID, ParameterType.GameObject); } else if (invAction == InvAction.Replace) { EditorGUILayout.Space(); replaceParameterID = Action.ChooseParameterGUI("Object to delete:", parameters, replaceParameterID, ParameterType.GameObject); if (replaceParameterID >= 0) { replaceConstantID = 0; replaceGameObject = null; } else { replaceGameObject = (GameObject)EditorGUILayout.ObjectField("Object to delete:", replaceGameObject, typeof(GameObject), true); replaceConstantID = FieldToID(replaceGameObject, replaceConstantID); replaceGameObject = IDToField(replaceGameObject, replaceConstantID, false); } } AfterRunningOption(); }
override public void ShowGUI(List <ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer); if (!isPlayer) { obToMoveParameterID = Action.ChooseParameterGUI("Object to move:", parameters, obToMoveParameterID, ParameterType.GameObject); if (obToMoveParameterID >= 0) { obToMoveID = 0; obToMove = null; } else { obToMove = (GameObject)EditorGUILayout.ObjectField("Object to move:", obToMove, typeof(GameObject), true); obToMoveID = FieldToID(obToMove, obToMoveID); obToMove = IDToField(obToMove, obToMoveID, false); } } markerParameterID = Action.ChooseParameterGUI("Teleport to:", parameters, markerParameterID, ParameterType.GameObject); if (markerParameterID >= 0) { markerID = 0; teleporter = null; } else { teleporter = (Marker)EditorGUILayout.ObjectField("Teleport to:", teleporter, typeof(Marker), true); markerID = FieldToID <Marker> (teleporter, markerID); teleporter = IDToField <Marker> (teleporter, markerID, false); } positionRelativeTo = (PositionRelativeTo)EditorGUILayout.EnumPopup("Position relative to:", positionRelativeTo); if (positionRelativeTo == PositionRelativeTo.RelativeToGameObject) { relativeGameObjectParameterID = Action.ChooseParameterGUI("Relative GameObject:", parameters, relativeGameObjectParameterID, ParameterType.GameObject); if (relativeGameObjectParameterID >= 0) { relativeGameObjectID = 0; relativeGameObject = null; } else { relativeGameObject = (GameObject)EditorGUILayout.ObjectField("Relative GameObject:", relativeGameObject, typeof(GameObject), true); relativeGameObjectID = FieldToID(relativeGameObject, relativeGameObjectID); relativeGameObject = IDToField(relativeGameObject, relativeGameObjectID, false); } } else if (positionRelativeTo == PositionRelativeTo.EnteredValue) { relativeVectorParameterID = Action.ChooseParameterGUI("Value:", parameters, relativeVectorParameterID, ParameterType.Vector3); if (relativeVectorParameterID < 0) { relativeVector = EditorGUILayout.Vector3Field("Value:", relativeVector); } } else if (positionRelativeTo == PositionRelativeTo.VectorVariable) { variableLocation = (VariableLocation)EditorGUILayout.EnumPopup("Source:", variableLocation); switch (variableLocation) { case VariableLocation.Global: vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.GlobalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.GlobalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } break; case VariableLocation.Local: if (!isAssetFile) { vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.LocalVariable); if (vectorVarParameterID < 0) { vectorVarID = AdvGame.LocalVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3); } } else { EditorGUILayout.HelpBox("Local variables cannot be accessed in ActionList assets.", MessageType.Info); } break; case VariableLocation.Component: vectorVarParameterID = Action.ChooseParameterGUI("Vector3 variable:", parameters, vectorVarParameterID, ParameterType.ComponentVariable); if (vectorVarParameterID >= 0) { variables = null; variablesConstantID = 0; } else { variables = (Variables)EditorGUILayout.ObjectField("Component:", variables, typeof(Variables), true); variablesConstantID = FieldToID <Variables> (variables, variablesConstantID); variables = IDToField <Variables> (variables, variablesConstantID, false); if (variables != null) { vectorVarID = AdvGame.ComponentVariableGUI("Vector3 variable:", vectorVarID, VariableType.Vector3, variables); } } break; } } copyRotation = EditorGUILayout.Toggle("Copy rotation?", copyRotation); if (isPlayer) { snapCamera = EditorGUILayout.Toggle("Teleport active camera too?", snapCamera); } if (isPlayer || (obToMove != null && obToMove.GetComponent <Char>())) { recalculateActivePathFind = EditorGUILayout.Toggle("Recalculate pathfinding?", recalculateActivePathFind); } AfterRunningOption(); }
public override void ShowGUI(List<ActionParameter> parameters) { isPlayer = EditorGUILayout.Toggle ("Is Player?", isPlayer); if (!isPlayer) { obToMoveParameterID = Action.ChooseParameterGUI ("Object to move:", parameters, obToMoveParameterID, ParameterType.GameObject); if (obToMoveParameterID >= 0) { obToMoveID = 0; obToMove = null; } else { obToMove = (GameObject) EditorGUILayout.ObjectField ("Object to move:", obToMove, typeof(GameObject), true); obToMoveID = FieldToID (obToMove, obToMoveID); obToMove = IDToField (obToMove, obToMoveID, false); } } markerParameterID = Action.ChooseParameterGUI ("Teleport to:", parameters, markerParameterID, ParameterType.GameObject); if (markerParameterID >= 0) { markerID = 0; teleporter = null; } else { teleporter = (Marker) EditorGUILayout.ObjectField ("Teleport to:", teleporter, typeof (Marker), true); markerID = FieldToID <Marker> (teleporter, markerID); teleporter = IDToField <Marker> (teleporter, markerID, false); } positionRelativeTo = (PositionRelativeTo) EditorGUILayout.EnumPopup ("Position relative to:", positionRelativeTo); copyRotation = EditorGUILayout.Toggle ("Copy rotation?", copyRotation); if (isPlayer) { snapCamera = EditorGUILayout.Toggle ("Teleport active camera too?", snapCamera); } AfterRunningOption (); }