public void FadeOut(int statusCase, SpriteRenderer spriteRenderer) //매개변수 스프라이트에 페이드 아웃 효과를 준다. statusCase에 따라 오브젝트의 상태를 변경한다. { ObjectInformation objectInformation = new ObjectInformation(spriteRenderer, false); objectInformation.statusCase = statusCase; targetObject.Add(objectInformation); }
public GameObject unpack(SaveData data) { if (!objects.Prefabs.ContainsKey(data.prefabName)) { throw new Exception("Cannot find: " + data.prefabName + ", did the path change after the last save?"); return(null); } GameObject gameObject = Instantiate(objects.Prefabs[data.prefabName], data.position, data.rotation) as GameObject; gameObject.name = data.objectName; gameObject.transform.localScale = data.localScale; gameObject.SetActive(data.active); if (!gameObject.GetComponent <ObjectInformation>()) { ObjectInformation oi = gameObject.AddComponent <ObjectInformation>(); } componentUnpacker.unpack(ref gameObject, data); ObjectInformation[] childrenIds = gameObject.GetComponentsInChildren <ObjectInformation>(); foreach (ObjectInformation childrenIDScript in childrenIds) { if (childrenIDScript.transform != gameObject.transform) { if (string.IsNullOrEmpty(childrenIDScript.GetId)) { Destroy(childrenIDScript.gameObject); } } } return(gameObject); }
public SaveData pack(ObjectInformation objectToPack) { object[] allComponents = objectToPack.gameObject.GetComponents <Component>() as object[]; List <string> allowedComponents = new List <string> () { "UnityEngine.Collider", "UnityEngine.MonoBehaviour", "UnityEngine.Collider2D", "UnityEngine.Component" }; List <ComponentInfo> componentsToSave = new List <ComponentInfo> (); foreach (object component in allComponents) { for (int i = 0; i < allowedComponents.Count; i++) { if (allowedComponents[i].Contains(component.GetType().BaseType.FullName)) { componentsToSave.Add(componentPacker.pack(component)); } } } SaveData objectData = new SaveData(); objectData.objectName = objectToPack.GetName; objectData.prefabName = objectToPack.GetPrefabName; objectData.idParent = objectToPack.getParentId(); objectData.id = objectToPack.GetId; objectData.active = objectToPack.gameObject.activeSelf; objectData.position = objectToPack.transform.position; objectData.localScale = objectToPack.transform.localScale; objectData.rotation = objectToPack.transform.rotation; return(objectData); }
public void Update() { position = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); dragging = IsDragging(); RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { ObjectInformation info = hit.transform.GetComponent <ObjectInformation> (); if (info) { if (Input.GetMouseButtonUp(0) && info.item.type != ItemType.Deployer) { player.AddToInventory(info.item, info.item.count); info.item.DestroyWorldObject(); } else if (Input.GetMouseButtonUp(1)) { RightClickMenu rcm = transform.gameObject.AddComponent <RightClickMenu> (); rcm.Init(info.item, WindowType.WorldObject); print(info.item.type.ToString()); } } } }
/// <summary> /// gibt den Standardwert für den angegebenen Informationstyp zurück /// </summary> private static string LoadDefaultValue(this ObjectInformation informationType) { if (informationType == ObjectInformation.objectType) { //der Objekt Typ muss angegeben werden throw new Exception(); } //Zahlenwerte sind standardmäßig 0 else if ((informationType == ObjectInformation.endX) || (informationType == ObjectInformation.endY) || (informationType == ObjectInformation.angle) || (informationType == ObjectInformation.width) || (informationType == ObjectInformation.height)) { return("0"); } else if (informationType == ObjectInformation.lineMode) { return("Normal"); } //bool else if (informationType == ObjectInformation.inverted) { return("false"); } return(""); }
void Start() { animator = GetComponent <Animator> (); info = GetComponent <ObjectInformation> (); item = info.item; player = item.player; audio = GetComponent <AudioSource> (); }
public void FadeIn(SpriteRenderer spriteRenderer) //매개변수 스프라이트에 페이드인 효과를 준다. { ObjectInformation objectInformation = new ObjectInformation(spriteRenderer, true); objectInformation.color.a = 0; spriteRenderer.color = objectInformation.color; spriteRenderer.gameObject.SetActive(true); targetObject.Add(objectInformation); }
private void OnCollisionEnter(Collision collision) { ObjectInformation obInfo = collision.gameObject.GetComponent <ObjectInformation>(); if (obInfo != null) { obInfo.currentHealth -= 1f; } }
public RightClickMenu(ObjectInformation selectedObj, int x, int y, List<MenuItem> choices) { this.X = x; this.Y = y; this.Visible = true; this.SelectedObj = selectedObj; items = choices; items[0].Text = "Obj index: " + selectedObj.Index.ToString(); items[0].Value = ""; leftMousePressed = true; }
public ObjectInfoViewModel(ObjectInformation objectInformation, Dispatcher dispatcher) { this.objectInformation = objectInformation; this.dispatcher = dispatcher; //this.objectInformation.ObjectReferences.CollectionChanged += ObjectReferences_CollectionChanged; this.objectInformation.ReferencesChanged += objectInformation_ReferencesChanged; GcCollectCommand = base.AddNewCommand(new ActionCommand(GcCollect)); }
public override void ProcessTextureObject(ObjectInformation oi) { switch (oi.name.ToUpper()) { case "CAMERAOBJECT": CameraObject cameraObject = new CameraObject(2000, 2, oi.position, true, oi.name); return; } //If we have come this far we will create a tile with the texture Tile t = new Tile(item.getTexture(), item.Position, layer.ScrollSpeed, item.Name, layer.Name); }
private void CallHandleMatchListView(SystemHandleEntry handle, ObjectInformation info) { ListViewItem item = new ListViewItem(); item.Name = handle.ProcessId.ToString() + " " + handle.Handle.ToString(); item.Text = Program.ProcessProvider.Dictionary[handle.ProcessId].Name + " (" + handle.ProcessId.ToString() + ")"; item.Tag = handle; item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.TypeName)); item.SubItems.Add(new ListViewItem.ListViewSubItem(item, info.BestName)); item.SubItems.Add(new ListViewItem.ListViewSubItem(item, "0x" + handle.Handle.ToString("x"))); OnMatchListView(item); }
void UpdateIfNeeded(HierarchyFrameDataView frameDataView, int selectedId) { var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView); if (!needReload) { return; } m_FrameDataView = frameDataView; m_SelectedID = selectedId; m_TreeView.SetSelection(new List <int>()); var samplesCount = m_FrameDataView.GetItemMergedSamplesCount(selectedId); var columnsCount = m_MultiColumnHeader.columns.Length; var objectsData = new List <ObjectInformation>(); var objectsDatas = new List <string> [columnsCount]; // Collect all the data var instanceIDs = new List <int>(samplesCount); m_FrameDataView.GetItemMergedSamplesInstanceID(selectedId, instanceIDs); for (var i = 0; i < columnsCount; i++) { objectsDatas[i] = new List <string>(samplesCount); m_FrameDataView.GetItemMergedSamplesColumnData(selectedId, m_MultiColumnHeader.columns[i].profilerColumn, objectsDatas[i]); } // Store it per sample for (var i = 0; i < samplesCount; i++) { var objData = new ObjectInformation() { columnStrings = new string[columnsCount] }; objData.id = selectedId; objData.sampleIndex = i; objData.instanceId = (i < instanceIDs.Count) ? instanceIDs[i] : 0; for (var j = 0; j < columnsCount; j++) { objData.columnStrings[j] = (i < objectsDatas[j].Count) ? objectsDatas[j][i] : string.Empty; } objectsData.Add(objData); } m_TreeView.SetData(objectsData); }
/// <summary> /// Gets the scenes object information. /// </summary> /// <returns>A container containing a list of ObjectInformation</returns> private ListContainer GetScenesObjectInformation() { List <ObjectInformation> oiList = new List <ObjectInformation>(); int numberOfAnimals = AnimalsParent.transform.childCount; ObjectInformation oi; Transform animal; for (int i = 0; i < numberOfAnimals; i++) { animal = AnimalsParent.transform.GetChild(i); oi = new ObjectInformation(); // Add id oi.ID = i; // Add position oi.Position[0] = animal.position.x; oi.Position[1] = animal.position.y; oi.Position[2] = animal.position.z; // Add rotation oi.Quaternion[0] = animal.rotation.w; oi.Quaternion[1] = animal.rotation.x; oi.Quaternion[2] = animal.rotation.y; oi.Quaternion[3] = animal.rotation.z; // Add scale oi.Scale[0] = animal.localScale.x; oi.Scale[1] = animal.localScale.y; oi.Scale[2] = animal.localScale.z; // Add prefab type oi.objectsPrefab = animal.GetComponent <ObjectController>().objectPrefab; // Add to list oiList.Add(oi); } return(new ListContainer(oiList)); }
public override void ProcessPrimitiveObject(ObjectInformation oi) { if (oi.customProperties.Count == 0) //No custom properties means a regular platform { Platform tempPlatform = new Platform(oi.width, oi.height, oi.position, oi.name); return; } else { switch (oi.customProperties[0].ToUpper()) { case "SLOPE": Platform tempSlope = new Platform(oi.width, oi.height, oi.position, oi.name, true); return; case "INVERSLOPE": Platform tempInverSlope = new Platform(oi.width, oi.height, oi.position, oi.name, false); return; } } }
private void OnCollisionEnter(Collision collision) { bool hitPlayer = false; if (collision.gameObject.tag != "Player" && !hitPlayer) { hitPlayer = false; ObjectInformation obInfo = collision.gameObject.GetComponent <ObjectInformation>(); EnemyManager enemyManager = collision.gameObject.GetComponent <EnemyManager>(); if (enemyManager != null) { enemyManager.hasBeenHit = true; } if (obInfo != null) { obInfo.currentHealth -= 1f; } NavMeshAgent agent = collision.transform.GetComponent <NavMeshAgent>(); if (agent != null) { // If the agent is found, store it's rigidbody, disable the agent, and add force to the gameObject. Rigidbody rb = agent.GetComponent <Rigidbody>(); agent.enabled = false; rb.AddForce(-collision.contacts[0].normal * batImpactForce, ForceMode.Impulse); Debug.Log("The bat hit " + collision.gameObject.name); } } else { hitPlayer = true; } }
private void OnCollisionEnter(Collision collision) { ObjectInformation obInfo = collision.gameObject.GetComponent <ObjectInformation>(); if (obInfo != null) { obInfo.currentHealth -= 1f; } NavMeshAgent agent = collision.transform.GetComponent <NavMeshAgent>(); if (agent != null) { // If the agent is found, store it's rigidbody, disable the agent, and add force to the gameObject. Rigidbody rb = agent.GetComponent <Rigidbody>(); agent.enabled = false; rb.AddForce(-collision.contacts[0].normal * batImpactForce, ForceMode.Impulse); } }
// Use this for initialization void Start() { // Get InformationScripts of Last and Next TunnelSystem LastTunnelInfo = TunnelSystems[LastTunnel].GetComponent <ObjectInformation>(); NextTunnelInfo = TunnelSystems[NextTunnel].GetComponent <ObjectInformation>(); NTunnel = TunnelSystems[NextTunnel].GetComponent <ObjectInformation>(); // Build amount of Tunnels at Start of Game(Set 'TunnelInAdvance' value in inspector) while (DefaultTunnelInAdvance > 0) { NextTunnel = 0; InstantiateDefaultTunnel(); DefaultTunnelInAdvance--; } // Build amount of Tunnels at Start of Game (Set 'TunnelInAdvance' value in inspector) while (TunnelInAdvance > 0) { InstantiateTunnel(); TunnelInAdvance--; } InvokeRepeating("InstantiateTunnel", 1f, 1f); }
public void ShakeObject(Transform transform, float shakeTime, float shakeAmount) //매개변수로 전달된 트랜스폼의 게임오브젝트를 진동시킨다. { ObjectInformation objectInformation = new ObjectInformation(transform, shakeTime, shakeAmount); targetObject.Add(objectInformation); }
public HandleStatisticsWindow(int pid) { InitializeComponent(); this.AddEscapeToClose(); this.SetTopMost(); listTypes.AddShortcuts(); listTypes.ContextMenu = listTypes.GetCopyMenu(); listTypes.ListViewItemSorter = new SortedListViewComparer(listTypes); var typeStats = new Dictionary <string, int>(); using (var phandle = new ProcessHandle(pid, ProcessAccess.DupHandle)) { var handles = Windows.GetHandles(); foreach (var handle in handles) { if (pid != -1 && handle.ProcessId != pid) { continue; } ObjectInformation info; try { if (pid != -1) { info = handle.GetHandleInfo(phandle, false); } else { info = handle.GetHandleInfo(false); } } catch (Exception ex) { Logging.Log(ex); info = new ObjectInformation() { TypeName = "(unknown)" }; } if (typeStats.ContainsKey(info.TypeName)) { typeStats[info.TypeName]++; } else { typeStats.Add(info.TypeName, 1); } } } foreach (var pair in typeStats) { listTypes.Items.Add(new ListViewItem(new string[] { pair.Key, pair.Value.ToString("N0") })); } }
public void SetTextFromObject(ObjectInformation objectFrom) { nameText.text = "Name: " + objectFrom.name; //rest if (objectFrom.getRestState() != null) { restText.color = Color.black; if (objectFrom.getRestState().GetType() == typeof(RestState)) { restText.text = "Rest: No"; } else { restText.text = "Rest: Yes"; } } else { restText.text = "Rest:"; restText.color = Color.gray; } //move if (objectFrom.getMoveState() != null) { moveText.color = Color.black; if (objectFrom.getMoveState().GetType() == typeof(MoveState)) { moveText.text = "Move: No"; } else { moveText.text = "Move: Yes"; } } else { moveText.text = "Move:"; moveText.color = Color.gray; } //interact if (objectFrom.getInteractionState() != null) { interactionText.color = Color.black; if (objectFrom.getInteractionState().GetType() == typeof(InteractionState)) { interactionText.text = "Interaction: No"; } else { interactionText.text = "Interaction: Yes"; } } else { interactionText.text = "Interaction:"; interactionText.color = Color.gray; } //combat if (objectFrom.getCombatState() != null) { combatText.color = Color.black; if (objectFrom.getCombatState().GetType() == typeof(CombatState)) { combatText.text = "Combat: No"; } else { combatText.text = "Combat: Yes"; } } else { combatText.text = "Combat:"; combatText.color = Color.gray; } }
public byte[] Write() { MemoryStream m = new MemoryStream(); EndianBinaryWriter er = new EndianBinaryWriter(m, Endianness.LittleEndian); int NrSections = 0; if (ObjectInformation != null) { NrSections++; } if (Path != null) { NrSections++; } if (Point != null) { NrSections++; } if (Stage != null) { NrSections++; } if (KartPointStart != null) { NrSections++; } if (KartPointJugem != null) { NrSections++; } if (KartPointSecond != null) { NrSections++; } if (KartPointCannon != null) { NrSections++; } if (KartPointMission != null) { NrSections++; } if (CheckPoint != null) { NrSections++; } if (CheckPointPath != null) { NrSections++; } if (ItemPoint != null) { NrSections++; } if (ItemPath != null) { NrSections++; } if (EnemyPoint != null) { NrSections++; } if (EnemyPath != null) { NrSections++; } if (MiniGameEnemyPoint != null) { NrSections++; } if (MiniGameEnemyPath != null) { NrSections++; } if (Area != null) { NrSections++; } if (Camera != null) { NrSections++; } Header.SectionOffsets = new UInt32[NrSections]; Header.Write(er); int SectionIdx = 0; if (ObjectInformation != null) { WriteHeaderInfo(er, SectionIdx); ObjectInformation.Write(er); SectionIdx++; } if (Path != null) { WriteHeaderInfo(er, SectionIdx); Path.Write(er); SectionIdx++; } if (Point != null) { WriteHeaderInfo(er, SectionIdx); Point.Write(er); SectionIdx++; } if (Stage != null) { WriteHeaderInfo(er, SectionIdx); Stage.Write(er); SectionIdx++; } if (KartPointStart != null) { WriteHeaderInfo(er, SectionIdx); KartPointStart.Write(er); SectionIdx++; } if (KartPointJugem != null) { WriteHeaderInfo(er, SectionIdx); KartPointJugem.Write(er); SectionIdx++; } if (KartPointSecond != null) { WriteHeaderInfo(er, SectionIdx); KartPointSecond.Write(er); SectionIdx++; } if (KartPointCannon != null) { WriteHeaderInfo(er, SectionIdx); KartPointCannon.Write(er); SectionIdx++; } if (KartPointMission != null) { WriteHeaderInfo(er, SectionIdx); KartPointMission.Write(er); SectionIdx++; } if (CheckPoint != null) { WriteHeaderInfo(er, SectionIdx); CheckPoint.Write(er); SectionIdx++; } if (CheckPointPath != null) { WriteHeaderInfo(er, SectionIdx); CheckPointPath.Write(er); SectionIdx++; } if (ItemPoint != null) { WriteHeaderInfo(er, SectionIdx); ItemPoint.Write(er); SectionIdx++; } if (ItemPath != null) { WriteHeaderInfo(er, SectionIdx); ItemPath.Write(er); SectionIdx++; } if (EnemyPoint != null) { WriteHeaderInfo(er, SectionIdx); EnemyPoint.Write(er); SectionIdx++; } if (EnemyPath != null) { WriteHeaderInfo(er, SectionIdx); EnemyPath.Write(er); SectionIdx++; } if (MiniGameEnemyPoint != null) { WriteHeaderInfo(er, SectionIdx); MiniGameEnemyPoint.Write(er); SectionIdx++; } if (MiniGameEnemyPath != null) { WriteHeaderInfo(er, SectionIdx); MiniGameEnemyPath.Write(er); SectionIdx++; } if (Area != null) { WriteHeaderInfo(er, SectionIdx); Area.Write(er); SectionIdx++; } if (Camera != null) { WriteHeaderInfo(er, SectionIdx); Camera.Write(er); SectionIdx++; } byte[] result = m.ToArray(); er.Close(); return(result); }
private void ChooseNextTunnel() { // Choose the next tunnel based on settings given here NextTunnel = Random.Range(0, TunnelSystems.Length); // Don't build in yourself! if (directioncounterLeftRight == 1 && !NextTunnelChosen) { int i = Random.Range(1, 100); if (i < defaulttunnelchance) { NextTunnel = 0; } else { NextTunnel = 1; } NextTunnelChosen = true; } else if (directioncounterLeftRight == -1 && !NextTunnelChosen) { int i = Random.Range(1, 100); if (i < defaulttunnelchance) { NextTunnel = 0; } else { NextTunnel = 2; } NextTunnelChosen = true; } else if (directioncounterUpDown == 1 && !NextTunnelChosen) { NextTunnel = RandomExcept(0, TunnelSystems.Length, 3); NextTunnelChosen = true; } else if (directioncounterUpDown == -1 && !NextTunnelChosen) { NextTunnel = RandomExcept(0, TunnelSystems.Length, 4); NextTunnelChosen = true; } // Control height of tunnels if (NTunnel.NoDirectionalChange == false && !NextTunnelChosen) { NextTunnel = 0; NextTunnelChosen = true; } else if (currentHeight >= maxUpHeight && directioncounterUpDown == 1 && directioncounterLeftRight == 0 && !NextTunnelChosen) { NextTunnel = 4; NextTunnelChosen = true; } else if (currentHeight >= maxUpHeight && directioncounterUpDown == 1 && directioncounterLeftRight == 1 && !NextTunnelChosen) { NextTunnel = 2; NextTunnelChosen = true; } else if (currentHeight >= maxUpHeight && directioncounterUpDown == 1 && directioncounterLeftRight == -1 && !NextTunnelChosen) { NextTunnel = 1; NextTunnelChosen = true; } else if (currentHeight >= maxDownHeight && directioncounterUpDown == -1 && directioncounterLeftRight == 0 && !NextTunnelChosen) { NextTunnel = 3; NextTunnelChosen = true; } else if (currentHeight <= maxDownHeight && directioncounterUpDown == -1 && directioncounterLeftRight == 1 && !NextTunnelChosen) { NextTunnel = 2; NextTunnelChosen = true; } else if (currentHeight <= maxDownHeight && directioncounterUpDown == -1 && directioncounterLeftRight == -1 && !NextTunnelChosen) { NextTunnel = 1; NextTunnelChosen = true; } else if (currentHeight <= maxDownHeight && directioncounterUpDown == 0 && directioncounterLeftRight == 0 && !NextTunnelChosen) { NextTunnel = 3; NextTunnelChosen = true; } else if (currentHeight >= maxUpHeight && directioncounterUpDown == 0 && directioncounterLeftRight == 0 && !NextTunnelChosen) { NextTunnel = 4; NextTunnelChosen = true; } if (!NextTunnelChosen) { int i = Random.Range(1, 100); if (i < defaulttunnelchance) { NextTunnel = 0; } NextTunnelChosen = true; } NextTunnelInfo = TunnelSystems[NextTunnel].GetComponent <ObjectInformation>(); }
// Use this for initialization void Start() { anim = this.gameObject.GetComponent <Animator>(); GMng = GameObject.Find("_GameManager").GetComponent <GameMng>(); ObjInfo = this.gameObject.transform.parent.parent.GetComponent <ObjectInformation>(); }
/// <summary> /// gibt den zugehörigen string aus der Werteliste eines gewünschten Informationstyps zurück /// </summary> public static string GetObjectInformation(this Dictionary <ObjectInformation, string> informationDictionary, ObjectInformation informationType) { //findet Index des InformationsTyps //var index = informationTypeList.IndexOf(informationType); var index = informationDictionary.Keys.ToList().IndexOf(informationType); //Wenn die Information nicht gefunden wurde if (index < 0) { //Wird der Standertwert zurückgegeben return(informationType.LoadDefaultValue()); } //gibt den dazugehörigen Wert aud der Werteliste zurück //return informationValueList[index]; return(informationDictionary.Values.ElementAt(index)); }
/// <summary> /// konvertiert den angegebenen Informationstyp und den Wert in einen String /// </summary> public static string InformationToString(this ObjectInformation informationType, object value) { string line = informationType.ToString() + ":" + value + "/"; return(line); }
void UpdateIfNeeded(HierarchyFrameDataView frameDataView, int selectedId) { var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView); if (!needReload) { return; } m_FrameDataView = frameDataView; m_SelectedID = selectedId; m_TreeView.SetSelection(new List <int>()); var samplesCount = m_FrameDataView.GetItemMergedSamplesCount(selectedId); // Collect all the data var instanceIDs = new List <int>(samplesCount); m_FrameDataView.GetItemMergedSamplesInstanceID(selectedId, instanceIDs); var columns = m_MultiColumnHeader.columns; var columnsCount = columns.Length; var objectsDatas = new List <string> [columnsCount]; var objectsValueDatas = new List <float> [columnsCount]; for (var i = 0; i < columnsCount; i++) { objectsDatas[i] = new List <string>(samplesCount); m_FrameDataView.GetItemMergedSamplesColumnData(selectedId, columns[i].profilerColumn, objectsDatas[i]); objectsValueDatas[i] = new List <float>(samplesCount); m_FrameDataView.GetItemMergedSamplesColumnDataAsFloats(selectedId, columns[i].profilerColumn, objectsValueDatas[i]); } // Store it per sample var objectsData = new List <ObjectInformation>(); for (var i = 0; i < samplesCount; i++) { var objData = new ObjectInformation() { columnStrings = new string[columnsCount], columnValues = new float[columnsCount] }; objData.id = selectedId; objData.sampleIndex = i; objData.instanceId = (i < instanceIDs.Count) ? instanceIDs[i] : 0; for (var j = 0; j < columnsCount; j++) { objData.columnStrings[j] = (i < objectsDatas[j].Count) ? objectsDatas[j][i] : string.Empty; objData.columnValues[j] = (i < objectsValueDatas[j].Count) ? objectsValueDatas[j][i] : 0.0f; } objectsData.Add(objData); } m_TreeView.SetData(objectsData); // Update instances label var sampleName = m_FrameDataView.GetItemName(selectedId); m_InstancesLabel.text = UnityString.Format(kInstancesCountFormatText, samplesCount, sampleName); m_InstancesLabel.tooltip = kInstancesCountTooltipText; }
public void SetNameSelected(ObjectInformation nS) { Debug.Log(nS.name); this.nameSet = nS; currentlySelectedText.text = nS.name; }
public void Init() { try { ObjectInformation handleInfo = ObjectHandle.GetHandleInfo(); _name = textName.Text = handleInfo.BestName; if (string.IsNullOrEmpty(textName.Text)) { textName.Text = "(unnamed object)"; } _typeName = textType.Text = handleInfo.TypeName; textAddress.Text = "0x" + ObjectHandle.Object.ToString("x"); textGrantedAccess.Text = "0x" + ObjectHandle.GrantedAccess.ToString("x"); if (ObjectHandle.GrantedAccess != 0) { try { Type accessEnumType = NativeTypeFactory.GetAccessType(handleInfo.TypeName); textGrantedAccess.Text += " (" + NativeTypeFactory.GetAccessString(accessEnumType, ObjectHandle.GrantedAccess) + ")"; } catch (NotSupportedException) { } } ObjectBasicInformation basicInfo = ObjectHandle.GetBasicInfo(); labelReferences.Text = "References: " + (basicInfo.PointerCount - 1); labelHandles.Text = "Handles: " + basicInfo.HandleCount.ToString(); labelPaged.Text = "Paged: " + basicInfo.PagedPoolUsage.ToString(); labelNonPaged.Text = "Non-Paged: " + basicInfo.NonPagedPoolUsage.ToString(); if (HandlePropertiesCallback != null) { try { HandlePropertiesCallback(groupObjectInfo, _name, _typeName); } catch { } if (groupObjectInfo.Controls.Count == 0) { groupObjectInfo.Visible = false; } else if (groupObjectInfo.Controls.Count == 1) { Control control = groupObjectInfo.Controls[0]; // If it's a user control, dock it. if (control is UserControl) { control.Dock = DockStyle.Fill; control.Margin = new Padding(3); } else { control.Location = new System.Drawing.Point(10, 20); } } } } catch (Exception) { } this.ActiveControl = this.label1; }
/// <summary> /// Exports the level into an XML file /// </summary> private void SaveLevel() { LevelData level = new LevelData(); level.size = new Vector2(levelSize.Width, levelSize.Height); level.R = controls.R; level.G = controls.G; level.B = controls.B; level.tiles = new List<TileInformation>(); foreach (TileInformation t in tileInfo) TileInformation.AddTile(level.tiles, t.texture, new Vector2(t.X - levelSize.X, t.Y - levelSize.Y), t.Scale, t.Rotation, t.Layer, t.Effect); level.staticBodies = new List<StaticBodyInformation>(); foreach (StaticBodyInformation sb in sbInfo) { StaticBodyInformation body = new StaticBodyInformation(); foreach (Vector2 p in sb.Points) body.AddPoint(new Vector2(p.X - levelSize.X, p.Y - levelSize.Y)); level.staticBodies.Add(body); } level.objects = new List<ObjectInformation>(); foreach (ObjectInformation obj in objInfo) { ObjectInformation moved = new ObjectInformation(); moved.Index = obj.Index; moved.ParameterNames = obj.ParameterNames; moved.ParameterValues = obj.ParameterValues; moved.Position = obj.Position - new Vector2(levelSize.X, levelSize.Y); moved.Texture = obj.Texture; moved.Type = obj.Type; moved.Scripts = obj.Scripts; level.objects.Add(moved); } level.cameras = new List<CameraBoxInformation>(); foreach (CameraBoxInformation cam in camInfo) { CameraBoxInformation moved = new CameraBoxInformation( cam.Bounds.Left - (int)levelSize.X, cam.Bounds.Top - (int)levelSize.Y, cam.Bounds.Right - (int)levelSize.X, cam.Bounds.Bottom - (int)levelSize.Y, cam.Target, cam.Priority); level.cameras.Add(moved); } level.triggers = new List<TriggerInformation>(); foreach (TriggerInformation trigger in triggerInfo) { TriggerInformation moved = new TriggerInformation( trigger.Bounds.Left - (int)levelSize.X, trigger.Bounds.Top - (int)levelSize.Y, trigger.Bounds.Right - (int)levelSize.X, trigger.Bounds.Bottom - (int)levelSize.Y, trigger.Name, trigger.ObjID, trigger.WhenTrigger); level.triggers.Add(moved); } controls.Save(level); controls.SavePressed = false; }
/// <summary> /// Adds an object /// </summary> private void CreateObject() { if (step == 1) { mleftPressed = true; if (movedObject != null) currentObject = movedObject; else { currentObject = new ObjectInformation(); currentObject.Type = controls.SelectedObject.Type; currentObject.Texture = controls.SelectedObject.ToString(); currentObject.ParameterNames = controls.SelectedObject.Parameters; currentObject.ParameterValues = controls.SelectedObject.Parameters == null ? null : new string[controls.SelectedObject.Parameters.Length]; } currentObject.Position = camera.CameraToGlobalPos(new Vector2(Mouse.GetState().X, Mouse.GetState().Y)); if (currentObject.ParameterNames != null && currentObject.ParameterNames.Contains("Width")) currentObject.SetParameter("Width", selTexScale.X * ObjectTextures[currentObject.Texture].Width / camera.TotalScale); if (currentObject.ParameterNames != null && currentObject.ParameterNames.Contains("Height")) currentObject.SetParameter("Height", selTexScale.Y * ObjectTextures[currentObject.Texture].Height / camera.TotalScale); if (currentObject.ParameterNames != null && currentObject.ParameterNames.Contains("Scale")) currentObject.SetParameter("Scale", selTexScale); if (currentObject.ParameterNames != null && currentObject.ParameterNames.Contains("Rotation")) currentObject.SetParameter("Rotation", selTexRotation); if (currentObject.ParameterNames != null && currentObject.ParameterNames.Contains("FacingLeft")) currentObject.SetParameter("FacingLeft", selTexEffect == SpriteEffects.FlipHorizontally); if (movedObject == null) { if (currentObject.ParameterNames != null && (currentObject.ParameterNames.Contains("Radius") || currentObject.ParameterNames.Contains("Position2"))) // Add others later maybe { step = 2; return; } else step = 3; } else { movedObject = null; currentObject = null; return; } } else if (step == 2) { // Set other parameters mleftPressed = true; } if (step == 3) { UpdateIndex(); indices.Add(index); currentObject.Index = index; if (controls.SelectedObject.HasExtraParameters() && !windowOpen) { windowOpen = true; MouseState state = Mouse.GetState(); ParameterEditor editor = new ParameterEditor(); editor.Location = controls.Location; editor.Text = "ID: " + index; string[] extraParams = controls.SelectedObject.GetExtraParameters(); for (int i = 0; i < extraParams.Length; i++) { System.Windows.Forms.Label l = new System.Windows.Forms.Label(); l.Text = extraParams[i]; l.Location = new System.Drawing.Point(10, 10 + i * 30); l.Tag = i; editor.Controls.Add(l); System.Windows.Forms.TextBox t = new System.Windows.Forms.TextBox(); t.Location = new System.Drawing.Point(130, 10 + i * 30); t.Size = new System.Drawing.Size(275, t.Height); t.Tag = i; editor.Controls.Add(t); } System.Windows.Forms.DialogResult result = editor.ShowDialog(); for (int i = 0; i < editor.ParameterNames.Length; i++) currentObject.SetParameter(editor.ParameterNames[i], editor.ParameterValues[i]); windowOpen = false; } } objInfo.Add(currentObject); currentObject = null; step = 1; }
/// <summary> /// Updates the screen /// </summary> /// <param name="gameTime">The amount of time passed</param> protected override void Update(GameTime gameTime) { UpdateFocus(); if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { if (!escapePressed) { escapePressed = true; if (controls.CreatingCam) { controls.CreatingCam = false; step = 1; } else if (controls.CreatingMap) { controls.CreatingMap = false; currentBody = null; } else if (controls.CreatingTrigger) { controls.CreatingTrigger = false; step = 1; } else if (currentObject != null) { currentObject = null; movedObject = null; step = 1; } else if (changingBounds) changingBounds = false; else this.Exit(); } } else escapePressed = false; if (Keyboard.GetState().IsKeyDown(Keys.Tab) && Keyboard.GetState().IsKeyDown(Keys.LeftControl) && !windowOpen) { if (!tabPressed) { tabPressed = true; if (Keyboard.GetState().IsKeyDown(Keys.LeftShift)) ((System.Windows.Forms.TabControl)controls.Controls["tabControl"]).SelectedIndex = (((System.Windows.Forms.TabControl)controls.Controls["tabControl"]).SelectedIndex == 0 ? 2 : ((System.Windows.Forms.TabControl)controls.Controls["tabControl"]).SelectedIndex - 1); else ((System.Windows.Forms.TabControl)controls.Controls["tabControl"]).SelectedIndex = (((System.Windows.Forms.TabControl)controls.Controls["tabControl"]).SelectedIndex == 2 ? 0 : ((System.Windows.Forms.TabControl)controls.Controls["tabControl"]).SelectedIndex + 1); } } else tabPressed = false; if (controls.Tab == 0) { if (controls.NewPressed) NewLevel(); else if (controls.SavePressed) SaveLevel(); else if (controls.LoadPressed) LoadLevel(); else if (controls.ColDonePressed || controls.CamDonePressed) ResetControlButtons(); } else if (controls.Tab == 1) { if (controls.SelectedTile != null) selectedTexture = TileTextures[controls.SelectedTile]; } else if (controls.Tab == 2) { if (controls.SelectedObject != null) selectedTexture = ObjectTextures[controls.SelectedObject.ToString()]; } CheckRightClickMenu(); UpdateMouseStuff(); base.Update(gameTime); }
/// <summary> /// Checks the right click menu for selected choices /// </summary> private void CheckRightClickMenu() { if (rcMenu != null && rcMenu.Visible) { mleftPressed = true; string result = rcMenu.Update(Mouse.GetState()); if (result != "") { ObjectInformation obj = rcMenu.SelectedObj; if (result == "edit" && obj.HasExtraParameterNames()) { windowOpen = true; ParameterEditor editor = new ParameterEditor(); editor.Location = controls.Location; editor.Text = "ID: " + obj.Index.ToString(); string[] extraParams = obj.GetExtraParameterNames(); for (int i = 0; i < extraParams.Length; i++) { System.Windows.Forms.Label l = new System.Windows.Forms.Label(); l.Text = extraParams[i]; l.Location = new System.Drawing.Point(10, 10 + i * 30); l.Tag = i; editor.Controls.Add(l); System.Windows.Forms.TextBox t = new System.Windows.Forms.TextBox(); t.Location = new System.Drawing.Point(130, 10 + i * 30); t.Size = new System.Drawing.Size(275, t.Height); t.Text = obj.ValueFromName(extraParams[i]); t.Tag = i; editor.Controls.Add(t); } System.Windows.Forms.DialogResult dialogResult = editor.ShowDialog(); for (int i = 0; i < editor.ParameterNames.Length; i++) obj.SetParameter(editor.ParameterNames[i], editor.ParameterValues[i]); windowOpen = false; } else if (result == "delete") { indices.Remove(obj.Index); objInfo.Remove(obj); UpdateIndex(); } else if (result == "move") { movedObject = obj; step = 1; } else if (result == "scripts") { windowOpen = true; ScriptManager manager = new ScriptManager(); manager.Location = controls.Location; manager.Text = "Script Manager for Obj #" + obj.Index.ToString(); if (obj.Scripts != null) for (int i = 0; i < obj.Scripts.Count; i++) ((System.Windows.Forms.ListBox)manager.Controls["lstScripts"]).Items.Add(obj.Scripts[i]); System.Windows.Forms.DialogResult dialogResult = manager.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { obj.Scripts = new List<ScriptInformation>(); for (int i = 0; i < ((System.Windows.Forms.ListBox)manager.Controls["lstScripts"]).Items.Count; i++) obj.Scripts.Add((ScriptInformation)((System.Windows.Forms.ListBox)manager.Controls["lstScripts"]).Items[i]); } windowOpen = false; } } } }
private void Start() { animalName = GameObject.FindGameObjectWithTag("GameController").GetComponent <ObjectInformation>(); //cameraControl = Camera.main.GetComponent<headMovement>(); }
public void InstantiateTunnel() { // Change the position of the builder to the position, where the object has to be instantiated, using NextTunnelInfo.pivotlength Vector3 OldPosition = transform.localPosition; Vector3 NewPosition = new Vector3(0, 0, 0); if (directioncounterUpDown == 1 && directioncounterLeftRight == 0 || directioncounterUpDown == 1 && directioncounterLeftRight == -1 && LastTunnelInfo.goingUp || directioncounterUpDown == 1 && directioncounterLeftRight == 1 && LastTunnelInfo.goingUp) { //FACING UP NewPosition = new Vector3(0, NextTunnelInfo.pivotlength, 0); transform.Translate(NewPosition, Space.World); } else if (directioncounterUpDown == -1 && directioncounterLeftRight == 0 || directioncounterUpDown == -1 && directioncounterLeftRight == -1 && LastTunnelInfo.goingDown || directioncounterUpDown == -1 && directioncounterLeftRight == 1 && LastTunnelInfo.goingDown) { //FACING DOWN NewPosition = new Vector3(0, -NextTunnelInfo.pivotlength, 0); transform.Translate(NewPosition, Space.World); } else if (directioncounterUpDown == 1 && directioncounterLeftRight == 1 && LastTunnelInfo.goingRight || directioncounterUpDown == -1 && directioncounterLeftRight == 1 && LastTunnelInfo.goingRight || directioncounterLeftRight == 1 && directioncounterUpDown == 0 || NTunnel.TunnelDir == ObjectInformation.TunnelDirection.UpRight || NTunnel.TunnelDir == ObjectInformation.TunnelDirection.DownRight) { //FACING RIGHT NewPosition = new Vector3(NextTunnelInfo.pivotlength, 0, 0); transform.Translate(NewPosition, Space.World); } else if (directioncounterUpDown == 1 && directioncounterLeftRight == -1 && LastTunnelInfo.goingLeft || directioncounterUpDown == -1 && directioncounterLeftRight == -1 && LastTunnelInfo.goingLeft || directioncounterLeftRight == -1 && directioncounterUpDown == 0 || NTunnel.TunnelDir == ObjectInformation.TunnelDirection.UpLeft || NTunnel.TunnelDir == ObjectInformation.TunnelDirection.DownLeft) { //FACING LEFT NewPosition = new Vector3(-NextTunnelInfo.pivotlength, 0, 0); transform.Translate(NewPosition, Space.World); } else { //FACING FORWARD NewPosition = new Vector3(0, 0, NextTunnelInfo.pivotlength); transform.Translate(NewPosition, Space.World); } // Instantiating the TunnelSystem if (NextTunnel != 0) { NewTunnel = Instantiate(TunnelSystems[NextTunnel], transform.localPosition, transform.localRotation); LastTunnel = NextTunnel; LastTunnelInfo = TunnelSystems[LastTunnel].GetComponent <ObjectInformation>(); } else if (NextTunnel == 0 && DefaultTunnelInAdvance == 0) { int i = Random.Range(0, DogeTunnelSystems.Length); NewTunnel = Instantiate(DogeTunnelSystems[i], transform.localPosition, transform.localRotation); LastTunnel = NextTunnel; LastTunnelInfo = DogeTunnelSystems[i].GetComponent <ObjectInformation>(); } NextTunnelChosen = false; // Revert the positionchange to prepare for the next tunnel transform.Translate(-NewPosition, Space.World); // If the TunnelSystem is changing the general direction, change the Direction-enum and rotate the object if (LastTunnelInfo.goingRight) { directioncounterLeftRight++; if (d == Direction.Zero) { d = Direction.Ninety; } else if (d == Direction.Ninety) { d = Direction.OneEighty; } else if (d == Direction.OneEighty) { d = Direction.TwoSeventy; } else if (d == Direction.TwoSeventy) { d = Direction.Zero; } transform.Rotate(0, 90, 0); } if (LastTunnelInfo.goingLeft) { directioncounterLeftRight--; if (d == Direction.Zero) { d = Direction.TwoSeventy; } else if (d == Direction.Ninety) { d = Direction.Zero; } else if (d == Direction.OneEighty) { d = Direction.Ninety; } else if (d == Direction.TwoSeventy) { d = Direction.OneEighty; } transform.Rotate(0, -90, 0); } if (LastTunnelInfo.goingUp) { directioncounterUpDown++; if (dUpDown == UpDownDirection.Zero) { dUpDown = UpDownDirection.Ninety; } else if (dUpDown == UpDownDirection.MinusNinety) { dUpDown = UpDownDirection.Zero; } transform.Rotate(-90, 0, 0); } if (LastTunnelInfo.goingDown) { directioncounterUpDown--; if (dUpDown == UpDownDirection.Zero) { dUpDown = UpDownDirection.MinusNinety; } else if (dUpDown == UpDownDirection.Ninety) { dUpDown = UpDownDirection.Zero; } transform.Rotate(90, 0, 0); } // TunnelDirection for rotationchange // Up NTunnel = NewTunnel.GetComponent <ObjectInformation>(); if (NTunnel.NoDirectionalChange) { if (directioncounterUpDown == 1 && directioncounterLeftRight == 0) { NTunnel.TunnelDir = ObjectInformation.TunnelDirection.Up; currentHeight++; } // UpRight else if (directioncounterUpDown == 1 && directioncounterLeftRight == 1) { currentLeftRight++; NTunnel.TunnelDir = ObjectInformation.TunnelDirection.UpRight; } // UpLeft else if (directioncounterUpDown == 1 && directioncounterLeftRight == -1) { currentLeftRight--; NTunnel.TunnelDir = ObjectInformation.TunnelDirection.UpLeft; } // Down else if (directioncounterUpDown == -1 && directioncounterLeftRight == 0) { NTunnel.TunnelDir = ObjectInformation.TunnelDirection.Down; currentHeight--; } // DownRight else if (directioncounterUpDown == -1 && directioncounterLeftRight == 1) { currentLeftRight++; NTunnel.TunnelDir = ObjectInformation.TunnelDirection.DownRight; } // DownLeft else if (directioncounterUpDown == -1 && directioncounterLeftRight == -1) { currentLeftRight--; NTunnel.TunnelDir = ObjectInformation.TunnelDirection.DownLeft; } // Right else if (directioncounterLeftRight == 1 && directioncounterUpDown == 0) { currentLeftRight++; NTunnel.TunnelDir = ObjectInformation.TunnelDirection.Right; } // Left else if (directioncounterLeftRight == -1 && directioncounterUpDown == 0) { currentLeftRight--; NTunnel.TunnelDir = ObjectInformation.TunnelDirection.Left; } // Forward else { NTunnel.TunnelDir = ObjectInformation.TunnelDirection.Forward; } } // Use the Environment object as parent for instantiated tunnelsystems NewTunnel.transform.parent = Environment.transform; timesbuilt += 1; NTunnel.TunnelNumber = timesbuilt; UpdateBuilderPosition(); ChooseNextTunnel(); }