Пример #1
0
    public static string CombinedPartNameMapper(CombinedPart combinedPart)
    {
        var species    = AnimalSpeciesMapper(combinedPart.GetSpecies());
        var bodyType   = BodyPartTypeMapper(combinedPart.GetType());
        var animalType = AnimalPartTypeMapper(combinedPart.GetType());

        return(bodyType + animalType + species);
    }
Пример #2
0
 public void UpdateBodyPart(CombinedPart combinedPart)
 {
     for (int i = currentParts.Count - 1; i >= 0; i--)
     {
         if (currentParts[i].type == combinedPart.GetType())
         {
             currentParts[i].species = combinedPart.GetSpecies();
             GetComponent <UpdateBody>().UpdateBodyPart(combinedPart);
             break;
         }
     }
 }
Пример #3
0
    private void UpdateArms(CombinedPart arms)
    {
        string fullName = CombinedPartNameMapper(arms);
        var    prefab   = GetCombinedPart(fullName);

        var childLegs = GetBodyPart("arms");
        var newLegs   = Instantiate(prefab, childLegs.transform.position, childLegs.transform.rotation);

        newLegs.transform.parent = transform;
        newLegs.tag = "arms";
        newLegs.GetComponent <Rigidbody>().isKinematic = true;
        newLegs.GetComponent <Rigidbody>().useGravity  = false;
        Destroy(childLegs);
    }
Пример #4
0
    public void UpdateBodyPart(CombinedPart part)
    {
        switch (part.GetType())
        {
        case PartType.ARMS:
            UpdateArms(part);
            break;

        case PartType.LEGS:
            UpdateLegs(part);
            break;

        case PartType.HEAD:
            UpdateHead(part);
            break;
        }
    }
Пример #5
0
    private void UpdateHead(CombinedPart head)
    {
        string fullName = CombinedPartNameMapper(head);
        var    prefab   = GetCombinedPart(fullName);

        var childLegs = GetBodyPart("head");

        Debug.Log(childLegs);
        Debug.Log(fullName + " " + prefab);
        var newLegs = Instantiate(prefab, childLegs.transform.position, childLegs.transform.rotation);

        newLegs.transform.parent = transform;
        newLegs.tag = "head";
        newLegs.GetComponent <Rigidbody>().isKinematic = true;
        newLegs.GetComponent <Rigidbody>().useGravity  = false;
        Destroy(childLegs);
    }