Example #1
0
 void LoadCreatureObjectColliders(SplicedCreature creature)
 {
     if (creatureObjectSetup != null)
     {
         LoadColliderData(body.GetComponent <CapsuleCollider> (), creature.body.bodyCol);
         LoadColliderData(head.GetComponent <CapsuleCollider> (), creature.head.headCol);
         LoadColliderData(frontLegsR.GetComponent <CapsuleCollider> (), creature.frontLegs.frontLegsRCol);
         LoadColliderData(frontLegsL.GetComponent <CapsuleCollider> (), creature.frontLegs.frontLegsLCol);
         LoadColliderData(backLegsR.GetComponent <CapsuleCollider> (), creature.backLegs.backLegsRCol);
         LoadColliderData(backLegsL.GetComponent <CapsuleCollider> (), creature.backLegs.backLegsLCol);
     }
 }
Example #2
0
    public void SetCreature(SplicedCreature splicedCreature)
    {
        oldCreature         = splicedCreature;
        head.sprite         = splicedCreature.head.head;
        jaw.sprite          = splicedCreature.jaw.jaw;
        body.sprite         = splicedCreature.body.body;
        tail.sprite         = splicedCreature.tail.tail;
        frontLegsR.sprite   = splicedCreature.frontLegs.frontLegsR;
        frontLegsL.sprite   = splicedCreature.frontLegs.frontLegsL;
        backLegsR.sprite    = splicedCreature.backLegs.backLegsR;
        backLegsL.sprite    = splicedCreature.backLegs.backLegsL;
        creatureObjectSetup = splicedCreature.body;
        LoadCreatureObjectPivots();
        LoadCreatureObjectColliders(splicedCreature);
        jaw.transform.localPosition = splicedCreature.head.jawPivot;
        body.transform.localScale   = new Vector3(splicedCreature.body.uniformScale, splicedCreature.body.uniformScale, splicedCreature.body.uniformScale);

        creatureDamage = splicedCreature.head.damage +
                         splicedCreature.jaw.damage +
                         splicedCreature.body.damage +
                         splicedCreature.tail.damage +
                         splicedCreature.frontLegs.damage +
                         splicedCreature.frontLegs.damage +
                         splicedCreature.backLegs.damage +
                         splicedCreature.backLegs.damage +
                         splicedCreature.body.damage;

        creatureHealth = splicedCreature.head.health +
                         splicedCreature.jaw.health +
                         splicedCreature.body.health +
                         splicedCreature.tail.health +
                         splicedCreature.frontLegs.health +
                         splicedCreature.frontLegs.health +
                         splicedCreature.backLegs.health +
                         splicedCreature.backLegs.health +
                         splicedCreature.body.health;

        maxCreatureHealth    = creatureHealth;
        healthBar.fillAmount = creatureHealth / maxCreatureHealth;
    }