public void moveAnimal(PlayerDefaultDto dto) { GameObject gameObject = animals[dto.Id]; gameObject.transform.position = dto.positionToVector3(); gameObject.transform.rotation = dto.rotationToQuaternion(); }
public void createNewAnimal(PlayerDefaultDto dto) { Vector3 pos = dto.positionToVector3(); Quaternion rot = dto.rotationToQuaternion(); if (pos.x == 0 && pos.y == 0) { pos = new Vector3(transform.position.x - Random.Range(1, 10), transform.position.y - Random.Range(1, 15), -20); rot = transform.rotation; } string newId = System.Guid.NewGuid().ToString(); GameObject newAnimal = Instantiate(prefabs[0], pos, rot); AnimalStatus status = newAnimal.GetComponent <AnimalStatus>(); status.Id = newId; animals.Add(newId, newAnimal); }