Ejemplo n.º 1
0
    public void SetDNA(CreatureDescriptor DNA)
    {
        _critterDNA = DNA;

        // Spawn attachments on the critter
        CritterAttachmentManager AttachmentManager = GetComponentInChildren <CritterAttachmentManager>();

        if (AttachmentManager != null)
        {
            AttachmentManager.SpawnAttachments(_critterDNA);
        }

        // Apply color settings
        HasCritterColor[] childColors = _visualRoot.GetComponentsInChildren <HasCritterColor>();
        foreach (var childColor in childColors)
        {
            var r = childColor.GetComponent <Renderer>();
            if (r != null)
            {
                if (_critterMaterialInstance == null)
                {
                    _critterMaterialInstance = Instantiate(r.sharedMaterial);
                }

                _critterMaterialInstance.color = CritterConstants.GetCreatureColorValue(_critterDNA.Color);
                r.sharedMaterial = _critterMaterialInstance;
            }
        }

        SetAge(CritterConstants.GetCreatureAgeAtSize(_critterDNA.Size), animate: false);
    }
Ejemplo n.º 2
0
    public void SetDNA(CreatureDescriptor DNA)
    {
        _critterDNA = DNA;

        Renderer r = GetComponentInChildren <Renderer>();

        _materialInstance       = r.material;
        _materialInstance.color = CritterConstants.GetCreatureColorValue(_critterDNA.Color);
    }