private void MoveSetupBlocking(string[] parm, System.Action onComplete, MoveType type) { //find actor in scene with name parameters[0] Actor actor = SceneObjects.GetActor(parm[0]); //find location in scene with name parameters[1] Actor location = SceneObjects.GetActor(parm[1]); if (actor == null) { Debug.LogWarning($"No actor with name {parm[0]} found. Continuing dialogue"); onComplete?.Invoke(); return; } if (location == null) { Debug.LogWarning($"No actor with name {parm[1]} found. Destination not found, continuing dialogue"); onComplete?.Invoke(); return; } if (type == MoveType.wait) { actor.MoveActorBlocking(location.transform.position, onComplete); } }
private static void SetGlobalInstance(SceneObjects thiz) { if (thiz != null) { INSTANCE = thiz; } }
private void MoveSetupNonBlocking(string[] parms, MoveType type) { //find actor in scene with name parameters[0] Actor actor = SceneObjects.GetActor(parms[0]); //find location in scene with name parameters[1] Actor location = SceneObjects.GetActor(parms[1]); if (actor == null) { Debug.LogWarning($"No actor with name {parms[0]} found. Continuing dialogue"); return; } if (location == null) { Debug.LogWarning($"No location with name {parms[1]} found. Continuing dialogue"); return; } if (type == MoveType.move) { //Debug.Log("move to " + location.Position); actor.MoveActor(location.transform.position); } if (type == MoveType.instant) { actor.SetActorPosition(location.transform.position); } }
/// <summary> /// Performs all necessary initializations. /// </summary> private void Start() { // Create the 4 gizmos _objectMoveGizmo = RTGizmosEngine.Get.CreateObjectMoveGizmo(); _objectRotationGizmo = RTGizmosEngine.Get.CreateObjectRotationGizmo(); _objectScaleGizmo = RTGizmosEngine.Get.CreateObjectScaleGizmo(); _objectUniversalGizmo = RTGizmosEngine.Get.CreateObjectUniversalGizmo(); // Call the 'SetEnabled' function on the parent gizmo to make sure // the gizmos are initially hidden in the scene. We want the gizmo // to show only when we have a target object available. _objectMoveGizmo.Gizmo.SetEnabled(false); _objectRotationGizmo.Gizmo.SetEnabled(false); _objectScaleGizmo.Gizmo.SetEnabled(false); _objectUniversalGizmo.Gizmo.SetEnabled(false); // Link the selected objects list to the gizmos _objectMoveGizmo.SetTargetObjects(_selectedObjects); _objectRotationGizmo.SetTargetObjects(_selectedObjects); _objectScaleGizmo.SetTargetObjects(_selectedObjects); _objectUniversalGizmo.SetTargetObjects(_selectedObjects); // We initialize the work gizmo to the move gizmo by default. _workGizmo = _objectMoveGizmo; _workGizmoId = GizmoId.Move; // Find side menu sideMenu = GameObject.Find("SideMenu"); scene = sideMenu.GetComponent <SceneObjects>(); }
private void PedVariation(CutEvent e) { var args = e.EventArgs as CutObjectVariationEventArgs; if (args == null) { return; } var oe = e as CutObjectIdEvent; if (oe == null) { return; } CutsceneObject cso = null; SceneObjects.TryGetValue(oe.iObjectId, out cso); if (cso?.Ped != null) { int comp = args.iComponent; int drbl = args.iDrawable; int texx = args.iTexture; Task.Run(() => { cso.Ped.SetComponentDrawable(comp, drbl, 0, texx, GameFileCache); }); } }
private IEnumerator DoInitNewRow() { if (missString) { for (int i = 0; i < SceneObjects.Count; i++) { var objPosition = SceneObjects[i].transform.position; var target = new Vector2(objPosition.x, objPosition.y - 100); SceneObjects[i].MoveObject(target); } } missString = true; count = SceneObjects.Count; int colorChoise; int testChance = 0; ChangeLvlCube(); for (int i = 0; i < cubecount; i++) { var objectPosition = new Vector2(-(Screen.width / 2 - 53) + (i * 100), Screen.height / 2 - 53); if (Random.value > 1 - cubeChance) { testChance++; var canGenerateBonus = Random.value > 1 - bonusChance; if (canGenerateBonus) { BonusManager.I.GenerateBonus(BonusType.NewBall, objectPosition); count++; } continue; } else { var cube = Instantiate(cubePrefab); var colorCube = cube.GetComponent <ColorCube>(); SceneObjects.Add(colorCube); colorCube.transform.SetParent(rect); colorCube.transform.localPosition = objectPosition; } colorChoise = Random.Range(CubesLvlMin, CubesLvlMax); if (SceneObjects[count].GetComponent <ColorCube>() != null) { SceneObjects[count].GetComponent <ColorCube>().Init(colorChoise, Color.HSVToRGB(0.71f, 0.6f, 0.3f * colorChoise / 15)); } count++; } addTestMissChanse(testChance); if (CubesLvlMax - CubesLvlMin > 5) { CubesLvlMin++; } CubesLvlMax++; yield return(new WaitForSeconds(0.2f)); }
private void Cam(string[] parameters) { //<<cam>> will disable camName if (parameters == null) { ResetCam(); return; } //get cam CinemachineVirtualCamera newCam = SceneObjects.GetVCam(parameters[0]); //Debug.Log($"{newCam} selected, param0 {parameters[0]}"); if (activeCam != null) { activeCam.gameObject.SetActive(false); } activeCam = newCam; //enable/disable cam if (activeCam) { activeCam.gameObject.SetActive(true); //Debug.Log("Enabling Cam!"); } }
public void InitNewRound() { int colorChoise; int minLimit = 1; int maxLimit = 2; int testChanse = 0; int count = default(int); for (int i = 0; i < 1; i++) { for (int j = 0; j < cubecount; j++) { if (Random.value > 1 - cubeChance) { testChanse++; continue; } else { var cube = Instantiate(cubePrefab); var colorCube = cube.GetComponent <ColorCube>(); SceneObjects.Add(colorCube); colorCube.transform.SetParent(rect); colorCube.transform.localPosition = new Vector2(-(Screen.width / 2 - 53) + (j * 100), Screen.height / 2 - 53); } colorChoise = Random.Range(minLimit, maxLimit); SceneObjects[count].GetComponent <ColorCube>().Init(colorChoise, Color.HSVToRGB(initColor.r, initColor.g, initColor.b * colorChoise / 15)); count++; } TestMissChance(testChanse); } }
internal static void CallRPC(int id, byte rpcID, NetIncomingMessage message) { NetworkedSceneObject sceneObject; if (SceneObjects.TryGetValue(id, out sceneObject)) { Action <NetIncomingMessage> processor; if (sceneObject._rpcProcessors.TryGetValue(rpcID, out processor)) { if (processor != null) { processor(message); } else { Debug.LogWarning(sceneObject._net, "RPC processor for {0} was null. Automatically cleaning up. Please be sure to clean up after yourself in the future.", rpcID); sceneObject._rpcProcessors.Remove(rpcID); } } else { Debug.LogWarning(sceneObject._net, "NetworkedSceneObject on {0}: unhandled RPC {1}", id, rpcID); } } }
public static void instance_destroy() { if (currentObject.Layer != null) { currentObject.Layer.Objects.Remove(currentObject); SceneObjects.Remove(currentObject); } }
public static void instance_destroy(GameObject go) { if (go.Layer != null) { go.Layer.Objects.Remove(go); SceneObjects.Remove(go); } }
public FirstScene(PastelGame game) { BackgroundColour = RgbaFloat.CornflowerBlue; Game = game; var rec = new Rectangle(new Vector2(0.5f, -0.5f), 10); SceneObjects.Add(rec); }
public static bool instance_exists(Type t, bool notMe = true) { if (!notMe) { return(SceneObjects.FindIndex(x => x.GetType() == t && x.Id != currentObject.Id) != -1); } return(SceneObjects.FindIndex(x => x.GetType() == t) != -1); }
public SecondScene(PastelGame game) { BackgroundColour = RgbaFloat.DarkRed; Game = game; var rectangle = new Rectangle(new Vector2(-0.4f, 0.3f), 20); SceneObjects.Add(rectangle); }
public void Trace( SceneObjects Objects, Ray WorldRay ) { if ( Objects == null ) { throw new ArgumentNullException( "Objects" ); } Objects.Trace( WorldRay, ShapeHits, GeometryHits, ObjectHits ); }
private void Face(string[] parameters) { if (parameters == null) { return; } //Debug.Log("facing" + parameters[0] + parameters[1] + parameters[2]); int actorNameIndex = 0; Vector3 faceDirection = Vector3.zero; if (parameters.Length == 3) { faceDirection.x = float.Parse(parameters[1]); faceDirection.z = float.Parse(parameters[2]); } /** * Vector2 faceDirection = Vector2.zero; * if (parameters[0] == "up") * { * faceDirection = Vector2.up; * Debug.Log("facing up"); * } * else if (parameters[0] == "left") * { * faceDirection = Vector2.left; * Debug.Log("facing left"); * } * else if (parameters[0] == "down") * { * faceDirection = Vector2.down; * Debug.Log("facing down"); * } * else if (parameters[0] == "right") * { * faceDirection = Vector2.right; * Debug.Log("facing right"); * } * else * { * Debug.Log("movment facing"); * actorNameIndex = 0; * } **/ //Debug.Log("setting facing to " + faceDirection); Actor a = SceneObjects.GetActor(parameters[actorNameIndex]); if (a != null) { a.SetFacingEvent?.Invoke(faceDirection); } }
public void OnPointerClick(PointerEventData pointerEventData) { // Get sceneObjects script SceneObjects scene = sideMenu.GetComponent <SceneObjects>(); string objectName = gameObject.GetComponent <Text>().text; GameObject editorGameObject = objectsList.transform.Find(objectName).gameObject; // Set last selected object in SceneObject script & Higlight gameobject in editor scene.SelectGameObject(gameObject, editorGameObject); }
public static GameObject instance_nearset(Vector2 position, Type obj, bool countMe = false) { List <GameObject> selectedObjects = SceneObjects.FindAll(x => x.OriginalType == obj); if (selectedObjects.Count > 0) { return(selectedObjects.OrderBy(x => point_distance(x.Position, position)).ToList()[0]); } return(null); }
public void DestroyAllSceneObject() { initialcords = false; for (int i = 0; i < SceneObjects.Count; i++) { Destroy(SceneObjects[i].gameObject); } DestroyAllBalls(); Application.LoadLevel("MaineMenu"); SceneObjects.Clear(); //InitNewRound(); }
public static void SaveSceneObjPosesAsInt() { GameObject go = GameObject.Find("scene"); if (go == null) { Debug.LogError("SaveSceneObjPosesAsInt scene null"); } SceneObjects so = go.GetComponent <SceneObjects>(); so.HandleObjs(); so.HandleObstacles(); UnityEditor.SceneManagement.EditorSceneManager.SaveOpenScenes(); }
private void EnableHideObject(CutEvent e) { var oe = e as CutObjectIdEvent; if (oe == null) { return; } CutsceneObject cso = null; SceneObjects.TryGetValue(oe.iObjectId, out cso); if (cso != null) { cso.Enabled = true; } }
void Awake() { _current = this as SceneObjects; track = GameObject.FindGameObjectWithTag("TrackBase").transform; for (int i = 0; i < track.Find("TrackWaypoints").childCount; i++) { trackWayPoints.Add(track.Find("TrackWaypoints").GetChild(i)); } track = GameObject.FindGameObjectWithTag("TrackBase").transform; for (int i = 0; i < track.Find("GridPositions").childCount; i++) { gridPositions.Add(track.Find("GridPositions").GetChild(i)); } //carCam = Camera.main; }
public static void instance_destroy(Type type) { foreach (RoomLayer rl in roomLayers) { if (rl is ObjectLayer) { ObjectLayer ol = (ObjectLayer)rl; foreach (GameObject go in ol.Objects) { if (go.OriginalType == type) { go.Layer.Objects.Remove(go); SceneObjects.Remove(go); } } } } }
public void TrackActor(string name) { actorToTrack = SceneObjects.GetActorFromActorName(name); if (actorToTrack != null) { //got name StartCoroutine(MoveBox()); } else { // did not get name if (defaultLocation == null) { SetDesiredWorldPosition(Vector2.zero); } else { SetDesiredWorldPosition(defaultLocation.position); } } }
private void CameraCut(CutEvent e) { var args = e.EventArgs as CutCameraCutEventArgs; if (args == null) { return; } var oe = e as CutObjectIdEvent; if (oe == null) { return; } CutsceneObject obj = null; SceneObjects.TryGetValue(oe.iObjectId, out obj); if (obj == null) { return; } var pos = Position; var rot = Rotation * Quaternion.RotationAxis(Vector3.UnitX, 1.57079632679f); obj.Position = pos + rot.Multiply(args.vPosition); obj.Rotation = rot * args.vRotationQuaternion; CameraNearClip = (args.fNearDrawDistance > 0) ? Math.Min(args.fNearDrawDistance, 0.5f) : 0.5f; CameraFarClip = (args.fFarDrawDistance > 0) ? Math.Max(args.fFarDrawDistance, 1000.0f) : 12000.0f; CameraClipUpdate = true; CameraObject = obj; }
void Awake() { _instance = this; objectNameText = objectNameUI.transform.Find("objectName").GetComponent <Text>(); //初始化设备的碰撞体和名称信息 for (int i = 0; i < devices.Length; i++) { DeviceObjects.Add(DeviceColliders[i], devices[i]); DeviceCNNames.Add(DeviceColliders[i], GlobalData.Devices[i]); } //初始化生产工序段的碰撞体和名称信息 for (int i = 0; i < flows.Length; i++) { FlowNames.Add(FlowColliders[i], GlobalData.Flows[i]); FlowObjects.Add(FlowColliders[i], flows[i]); } //初始化储物柜的碰撞体和名称信息 LockersColliders = new string[lockers.Length]; for (int i = 0; i < lockers.Length; i++) { LockersColliders[i] = lockers[i].name + "-CF"; LockersName.Add(LockersColliders[i], "储柜" + (i + 1)); LockersObjects.Add(LockersColliders[i], lockers[i]); } //初始化监控器的碰撞体和名称信息 MonitorColliders = new string[monitors.Length]; for (int i = 0; i < monitors.Length; i++) { MonitorColliders[i] = monitors[i].name; MonitorNames.Add(MonitorColliders[i], "监控摄像机" + (i + 1)); MonitorsObjects.Add(MonitorColliders[i], monitors[i]); } }
private void UnloadModels(CutEvent e) { var args = e.EventArgs as CutObjectIdListEventArgs; if (args == null) { return; } if (args.iObjectIdList == null) { return; } foreach (var objid in args.iObjectIdList) { CutsceneObject obj = null; SceneObjects.TryGetValue(objid, out obj); if (obj != null) { obj.Enabled = false; } } }
public static void instance_destroy(Type type) { foreach (RoomLayer rl in roomLayers) { if (rl is ObjectLayer) { ObjectLayer ol = (ObjectLayer)rl; foreach (GameObject go in ol.Objects) { if (go.OriginalType == type) { go.Layer.Objects.Remove(go); SceneObjects.Remove(go); if (CollisionsTree.CollisionActiveTypes.Contains(go.GetType())) { SceneColliders.Remove(go); } } } } } }
void Destroy() { INSTANCE = null; }
public static GameObject instance_create(Vector2 position, Type obj, string layer) { // First we need to convert layer name to actual layer RoomLayer realLayer = roomLayers.FirstOrDefault(x => x.Name == layer); GameObject o = (GameObject)Activator.CreateInstance(obj); Spritesheet s = new Spritesheet(); if (o.Sprite != null) { s = Sprites.FirstOrDefault(x => x.Name == o.Sprite.TextureSource); } o.OriginalType = obj; o.TypeString = obj.ToString(); if (s == null) { Texture2D tx = ConvertToTexture(SimplexIde.Properties.Resources.Question_16x, GraphicsDevice); o.Sprite = new Sprite(); o.Sprite.Texture = tx; o.Sprite.ImageRectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); o.Sprite.TextureRows = 1; o.Sprite.TextureCellsPerRow = 1; o.Sprite.ImageSize = new Vector2(16, 16); o.Sprite.FramesCount = 1; o.FramesCount = 1; o.Sprite.cellW = 16; o.Sprite.cellH = 16; o.Position = new Vector2(position.X - 8, position.Y - 8); o.Sprite.ImageRectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); } else { o.Sprite.Texture = s.Texture; o.Sprite.ImageRectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, s.CellWidth, s.CellHeight); o.Sprite.TextureRows = s.Rows; o.Sprite.TextureCellsPerRow = s.Texture.Width / s.CellWidth; o.Sprite.ImageSize = new Vector2(s.CellWidth, s.CellHeight); o.Sprite.FramesCount = Math.Max((s.Texture.Width / s.CellWidth) * (s.Texture.Height / s.CellHeight) - 1, 1); o.FramesCount = Math.Max(o.Sprite.FramesCount - 1, 1); o.Sprite.cellW = s.CellHeight; o.Sprite.cellH = s.CellWidth; o.Position = new Vector2(position.X - s.CellWidth / 2f, position.Y - s.CellHeight / 2f); o.Sprite.ImageRectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, s.CellWidth, s.CellHeight); } o.LayerName = realLayer.Name; o.Layer = (ObjectLayer)realLayer; currentObject = o; o.EvtCreate(); o.Layer.Objects.Add(o); SceneObjects.Add(o); sh.RegisterObject(o); return(o); }
public static int instance_number(Type obj) { return(SceneObjects.FindAll(x => x.OriginalType == obj).Count); }
public static bool instance_exists(Guid guid) { return(SceneObjects.FindIndex(x => x.Id == guid) != -1); }
public SceneObject FindByUUID(string uuid) { return(SceneObjects.Find((x) => { return x.UUID == uuid; })); }
new void Awake() { sceneObjects = SceneObjects.Get(); base.Awake(); }