示例#1
0
    public void moveAnimal(PlayerDefaultDto dto)
    {
        GameObject gameObject = animals[dto.Id];

        gameObject.transform.position = dto.positionToVector3();
        gameObject.transform.rotation = dto.rotationToQuaternion();
    }
示例#2
0
    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);
    }
示例#3
0
    public void destroyAnimal(PlayerDefaultDto dto)
    {
        GameObject gameObject = animals[dto.Id];

        Destroy(gameObject);
    }