public void DrawLevel() { if (Level == null) { return; } if (_currentRoom == null) { _currentRoom = Level.CurrentRoom; } if (_smoothMovement != null) { _smoothMovement.Tick(); } if (HasCurrentRoomSwitched()) { Vector2 lastPosition = GetRelativeDistanceBetweenRooms(Level.CurrentRoom, _currentRoom); _smoothMovement = new SmoothMovement(lastPosition, new Vector2(0.0f, 0.0f), _inactiveRoomAlpha, 1.0f, _defaultScale, _defaultScale); _previousCurrentRoom = _currentRoom; } foreach (Room room in Level.Rooms) { CalculateAndSetDrawSettings(room, room == Level.CurrentRoom); DrawRoom(room, room == Level.CurrentRoom, Level.IsPlayerHit); } _currentRoom = Level.CurrentRoom; }
void Start() { GetComponent <Cam>().StopFollow(); bat.SetParent(null); StartCoroutine(SmoothMovement.Follow(bat, finalBatPos, batSmoothTime)); StartCoroutine(SmoothMovement.Follow(transform, toFollow, smoothTime)); PlayerPrefs.SetString("End", "true"); }
protected Packet GetMovementPacketFor(NetState state) { if (MovementPacket == null) { MovementPacket = new SmoothMovement(this, _containedObjects); MovementPacket.SetStatic(); } return(MovementPacket); }
void Start() { //Guardamos la posición de anclaje de la cámara anchor = transform.GetChild(0).GetComponent <Transform>().position; cam = SmoothMovement.mainCamera.gameObject; //Guardamos referencias a los scripts necesarios de la cámara movement = cam.gameObject.GetComponent <SmoothMovement>(); camSize = cam.gameObject.transform.GetChild(0).GetComponent <CameraSize>(); //Guardamos el tamaño base de la cámara defaultSize = camSize.GetSize(); }
IEnumerator Movement() { for (; ;) { for (int i = 0; i != transforms.Length; i++) { yield return(new WaitForSeconds(breaks[i])); yield return(StartCoroutine(SmoothMovement.Glide(transform, transforms[(i + 1) % transforms.Length].position, times[i]))); } } }
private void Awake() { if (mainCamera == null) { mainCamera = this; } else if (mainCamera != this) { Destroy(gameObject); return; } }
public override void SetLocationOnSmooth(Point3D newLocation) { Point3D oldLocation = Location; base.SetLocationOnSmooth(newLocation); int rx = newLocation.X - oldLocation.X; int ry = newLocation.Y - oldLocation.Y; m_ContainedObjects.ForEachObject( item => item.SetLocationOnSmooth(new Point3D(item.X + rx, item.Y + ry, item.Z)), mob => mob.SetLocationOnSmooth(new Point3D(mob.X + rx, mob.Y + ry, mob.Z))); SmoothMovement movementPacket = new SmoothMovement(this, m_ContainedObjects); movementPacket.SetStatic(); IPooledEnumerable eable = Map.GetClientsInRange(Location, GetMaxUpdateRange()); foreach (NetState state in eable) { Mobile m = state.Mobile; if (!m.CanSee(this)) { continue; } if (m.InRange(Location, GetUpdateRange(m))) { state.Send(movementPacket); if (!m.InRange(oldLocation, GetUpdateRange(m))) { SendInfoTo(state); } } if (Utility.InUpdateRange(Location, m.Location) && !Utility.InUpdateRange(oldLocation, m.Location)) { SendInfoTo(state); } } eable.Free(); movementPacket.Release(); m_ContainedObjects.ForEachMobile(mob => mob.NotifyLocationChangeOnSmooth(new Point3D(mob.Location.X - rx, mob.Location.Y - ry, mob.Location.Z))); }
void Start() { inputHandler = InputHandler.GetInstance(); gameController = GameController.GetInstance(); movementController = GetComponent <SmoothMovement> (); audioSource = GetComponent <AudioSource>(); if (isLeft) { inputHandler.LeftButtonEvent.AddListener(OnButtonPressed); } else { inputHandler.RightButtonEvent.AddListener(OnButtonPressed); } }
public Client(ChunkLoader cl) { this.socket = new Socket(SocketType.Stream, ProtocolType.Tcp); this.smoothMovement = new SmoothMovement(this.entityHandler); receiveBuffer = new byte[receiveBufferSize]; this.cl = cl; // If game world is in client if (World.isClient) { // Unity edition only #if UNITY_EDITOR // Startup local server this.lanServerProcess = new Process(); this.lanServerProcess.StartInfo.Arguments = "-Local"; if (!File.Exists(EnvironmentVariablesCentral.serverDir + invisLauncher)) { EnvironmentVariablesCentral.WriteInvisLaunchScript(); } if (File.Exists(EnvironmentVariablesCentral.serverDir + serverFile)) { this.lanServerProcess.StartInfo.FileName = EnvironmentVariablesCentral.serverDir + serverFile; } else { Panic(); } try{ this.lanServerProcess.Start(); } catch { Panic(); } // Standalone edition #else if (!File.Exists(EnvironmentVariablesCentral.serverDir + invisLauncher)) { EnvironmentVariablesCentral.WriteInvisLaunchScript(); } if (File.Exists(EnvironmentVariablesCentral.serverDir + serverFile)) { Application.OpenURL(EnvironmentVariablesCentral.serverDir + invisLauncher); } else { Panic(); } #endif this.ip = new IPAddress(new byte[4] { 127, 0, 0, 1 }); } // If game world is in server else { string[] segmentedIP = World.IP.Split('.'); byte[] connectionIP = new byte[4]; // If it's not a valid IPv4 if (segmentedIP.Length != 4) { Panic(); } // Tailors the IP else { for (int i = 0; i < 4; i++) { try{ connectionIP[i] = (byte)Convert.ToInt16(segmentedIP[i]); } catch (Exception e) { Debug.Log(e); Panic(); } } this.ip = new IPAddress(connectionIP); } } this.Connect(); }
public override void Start() { GridMovement = Player.gameObject.GetComponent <SmoothMovement>(); }
void Start() { transform.position = new Vector2(PlayerPrefs.GetFloat("CamX", 0), PlayerPrefs.GetFloat("CamY", 0)); followPlayer = StartCoroutine(SmoothMovement.Follow(transform, Player.player.transform, smoothTime, false, true)); }
void Update() { transform.eulerAngles = origin.eulerAngles + Vector3.forward * SmoothMovement.SineWave(Time.time - savedTimer, speed, angle); }
void Start() { Game = Game.Instance; GridMovement = GetComponent <SmoothMovement>(); }
void Update() { transform.position = origin + SmoothMovement.SineWave(Time.time - savedTimer, speed, GetHeight() - origin); }