public override void ActivateItem() { active = !active; if (!BoltNetwork.IsRunning || ControllerReferences.IndependantMP) { if (active) { GlobalReferences.TypeFilter.Add(templateID, GlobalReferences.PartProbs[templateID]); Highlight(); } else { GlobalReferences.TypeFilter.Remove(templateID); Lowlight(); } GlobalReferences.ClearAffectedList(); if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); } } else { ChangePartFilter evnt = ChangePartFilter.Create(); evnt.State = active; evnt.ID = templateID; evnt.Send(); } }
public override void OnEvent(BlockDestroy evnt) { if (entity.IsOwner) { GlobalReferences.AffectedParts.Remove(gameObject); GlobalReferences.FreeParts.Remove(gameObject); Part p = GetComponent <Part>(); if (PlacementReferences.InfiniteParts && p.Respawn) { GameObject go = GlobalReferences.PartSpawner.SpawnPart(p.TemplateID); go.GetComponent <Part>().Respawn = true; if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.AffectPart(go); GlobalReferences.FreeParts.Remove(go); } } if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); } BoltNetwork.Destroy(gameObject); } }
//methods #region public void ChangeTool(ToolsetControls.InputX input) { if (input == ToolsetControls.InputX.Enter) { return; } else if (input == ToolsetControls.InputX.Left) { if (affectedParts > 0) { --affectedParts; if (GlobalReferences.PlacementType == PlacementTypeTool.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(affectedParts); } } textMesh.text = affectedParts.ToString(); } else if (input == ToolsetControls.InputX.Right) { if (affectedParts < 999 && affectedParts <= GlobalReferences.FreeParts.Count + GlobalReferences.AffectedParts.Count) { ++affectedParts; if (GlobalReferences.PlacementType == PlacementTypeTool.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(affectedParts); } } textMesh.text = affectedParts.ToString(); } }
IEnumerator Activate() { for (int i = 0; i < GlobalReferences.Parts.Count; ++i) { GlobalReferences.Parts[i].SetActive(true); yield return(new WaitForSeconds(0.001f)); } GlobalReferences.ChangeAffectedNumber(NumberOfPartsTool.AffectedParts); }
public override void RightPressed() { if (PlacementReferences.AffectedParts < GlobalReferences.FreeParts.Count + GlobalReferences.AffectedParts.Count) { ++PlacementReferences.AffectedParts; if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); } } affectedPartsCounter.text = PlacementReferences.AffectedParts.ToString(); }
public override void LeftPressed() { if (PlacementReferences.AffectedParts > 0) { --PlacementReferences.AffectedParts; if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); } } affectedPartsCounter.text = PlacementReferences.AffectedParts.ToString(); }
public void ChangeTool(ToolsetControls.InputX input) { if (input == ToolsetControls.InputX.Enter) { if (activityFlags[offset]) { activityFlags[offset] = false; GlobalReferences.TypeFilter.Remove(partNames[offset]); GlobalReferences.ClearAffectedList(); if (GlobalReferences.PlacementType == PlacementTypeTool.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(NumberOfPartsTool.AffectedParts); } } else { activityFlags[offset] = true; GlobalReferences.TypeFilter.Add(partNames[offset]); GlobalReferences.ClearAffectedList(); if (GlobalReferences.PlacementType == PlacementTypeTool.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(NumberOfPartsTool.AffectedParts); } } ChangeColor(); } else if (input == ToolsetControls.InputX.Left) { if (offset > 0) { --offset; foreach (GameObject go in templates) { go.transform.localPosition = go.transform.localPosition - translateOffset; } } } else if (input == ToolsetControls.InputX.Right) { if (offset < activityFlags.Count - 1) { ++offset; foreach (GameObject go in templates) { go.transform.localPosition = go.transform.localPosition + translateOffset; } } } }
public override void OnEvent(BlockFreeze evnt) { Destroy(gameObject.GetComponent <ConstantForce>()); Part p = gameObject.GetComponent <Part>(); gameObject.transform.position = evnt.BlockPosition; gameObject.transform.rotation = evnt.BlockRotation; p.FreezePart(evnt.ID); p.Parent = evnt.ParentID; p.ParentCon = evnt.ParentCon; Part parentPart = GlobalReferences.FrozenParts[evnt.ParentID].GetComponent <Part>(); ConnectionVoxelContainer.RemoveConnection(parentPart.Connections[evnt.ParentCon]); ConnectionVoxelContainer.RemoveConnection(gameObject.GetComponent <Part>().Connections[evnt.ConnectionID]); parentPart.ChildCons.Add(evnt.ConnectionID); parentPart.SetInactive(parentPart.Connections[evnt.ParentCon]); p.SetInactive(p.Connections[evnt.ConnectionID]); parentPart.Children.Add((int)p.ID); gameObject.transform.position = evnt.BlockPosition; gameObject.transform.rotation = evnt.BlockRotation; if (PlacementReferences.InfiniteParts && entity.IsOwner && p.Respawn) { GameObject go = GlobalReferences.PartSpawner.SpawnPart(p.TemplateID); go.GetComponent <Part>().Respawn = true; if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.AffectPart(go); GlobalReferences.FreeParts.Remove(go); } } if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo && entity.IsOwner) { GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); } if (entity.IsOwner) { //entity.Freeze(true); } }
public override void OnEvent(ChangePartFilter evnt) { if (evnt.State) { GlobalReferences.TypeFilter.Add(evnt.ID, GlobalReferences.PartProbs[evnt.ID]); } else { GlobalReferences.TypeFilter.Remove(evnt.ID); } GlobalReferences.ClearAffectedList(); if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); } partFilterTIs[evnt.ID].ChangeState(evnt.State); }
void ToolChangeCaseHandler() { switch (active) { case PlaceChoreo.Place: { deactivateAllPlacementTools(); PlacementBehaviour.CarryGo[PlacementBehaviour.TempID].SetActive(true); break; } case PlaceChoreo.Choreo: { deactivateAllPlacementTools(); GlobalReferences.ChangeAffectedNumber(NumberOfPartsTool.AffectedParts); break; } case PlaceChoreo.PickNChose: { deactivateAllPlacementTools(); PlacementBehaviour.Aiming = true; break; } case PlaceChoreo.Delete: { deactivateAllPlacementTools(); PlacementBehaviour.Aiming = true; break; } case PlaceChoreo.DisableScanning: { deactivateAllPlacementTools(); PlacementBehaviour.DisableSphere.SetActive(true); break; } } }
void FreezeSinglePlayer() { Part p = gameObject.GetComponent <Part>(); p.FreezePart(); p.Parent = closestConnection.ParentPart.ID; p.ParentCon = closestConnection.ParentPart.Connections.IndexOf(closestConnection); p.ConToParent = bestOnPart.ParentPart.Connections.IndexOf(bestOnPart); ConnectionVoxelContainer.RemoveConnection(closestConnection); ConnectionVoxelContainer.RemoveConnection(bestOnPart); closestConnection.ParentPart.ChildCons.Add(bestOnPart.ParentPart.Connections.IndexOf(bestOnPart)); closestConnection.ParentPart.Children.Add((int)p.ID); bestOnPart.ParentPart.SetInactive(bestOnPart); closestConnection.ParentPart.SetInactive(closestConnection); if (PlacementReferences.InfiniteParts && p.Respawn) { GameObject go = GlobalReferences.PartSpawner.SpawnPart(p.TemplateID); go.GetComponent <Part>().Respawn = true; if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.AffectPart(go); GlobalReferences.FreeParts.Remove(go); } } if (PlacementReferences.PlacementType == PlacementReferences.PlaceChoreo.Choreo) { GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); } }
public override void ActivateItem() { PlacementReferences.PlacementType = PlacementReferences.PlaceChoreo.Choreo; GlobalReferences.ChangeAffectedNumber(PlacementReferences.AffectedParts); }