Beispiel #1
0
    public void SetTorso(GameObject torsoPrefab)
    {
        _creature = GetComponent <Creature>();

        if (_torso != null)
        {
            foreach (var bodypart in _bodyparts)
            {
                bodypart.transform.SetParent(null);
            }
            Destroy(_torso.gameObject);
        }

        _torso = Instantiate(torsoPrefab, this.transform).GetComponent <Torso>();
        _torso.SetColor(_creature.Species.Color);

        foreach (var part in _bodyparts)
        {
            CreatureJoint creatureJoint = _torso.GetJoint(part.Joint);
            part.Place(creatureJoint);
        }
    }