Example #1
0
 int getIdx(BODY_PARTS part)
 {
     return((int)(part));
 }
    public void init(string aniname, float time, BODY_PARTS part)
    {
        base.animation.Play(aniname);
        base.animation[aniname].normalizedTime = time;
        base.animation[aniname].speed          = 0f;
        switch (part)
        {
        case BODY_PARTS.UPPER:
            col_upper_arm_l.GetComponent <CapsuleCollider>().enabled = false;
            col_lower_arm_l.GetComponent <CapsuleCollider>().enabled = false;
            col_upper_arm_r.GetComponent <CapsuleCollider>().enabled = false;
            col_lower_arm_r.GetComponent <CapsuleCollider>().enabled = false;
            col_thigh_l.GetComponent <CapsuleCollider>().enabled     = false;
            col_shin_l.GetComponent <CapsuleCollider>().enabled      = false;
            col_thigh_r.GetComponent <CapsuleCollider>().enabled     = false;
            col_shin_r.GetComponent <CapsuleCollider>().enabled      = false;
            Object.Destroy(leg);
            Object.Destroy(hand_l);
            Object.Destroy(hand_r);
            Object.Destroy(blood_lower);
            Object.Destroy(blood_arm_l);
            Object.Destroy(blood_arm_r);
            base.gameObject.GetComponent <HERO_SETUP>().CreateHead();
            base.gameObject.GetComponent <HERO_SETUP>().CreateUpperBody();
            break;

        case BODY_PARTS.LOWER:
            col_upper_arm_l.GetComponent <CapsuleCollider>().enabled = false;
            col_lower_arm_l.GetComponent <CapsuleCollider>().enabled = false;
            col_upper_arm_r.GetComponent <CapsuleCollider>().enabled = false;
            col_lower_arm_r.GetComponent <CapsuleCollider>().enabled = false;
            col_head.GetComponent <CapsuleCollider>().enabled        = false;
            col_chest.GetComponent <BoxCollider>().enabled           = false;
            Object.Destroy(head);
            Object.Destroy(chest);
            Object.Destroy(hand_l);
            Object.Destroy(hand_r);
            Object.Destroy(blood_upper);
            Object.Destroy(blood_upper1);
            Object.Destroy(blood_upper2);
            Object.Destroy(blood_arm_l);
            Object.Destroy(blood_arm_r);
            base.gameObject.GetComponent <HERO_SETUP>().CreateLowerBody();
            break;

        case BODY_PARTS.ARM_L:
            col_upper_arm_r.GetComponent <CapsuleCollider>().enabled = false;
            col_lower_arm_r.GetComponent <CapsuleCollider>().enabled = false;
            col_thigh_l.GetComponent <CapsuleCollider>().enabled     = false;
            col_shin_l.GetComponent <CapsuleCollider>().enabled      = false;
            col_thigh_r.GetComponent <CapsuleCollider>().enabled     = false;
            col_shin_r.GetComponent <CapsuleCollider>().enabled      = false;
            col_head.GetComponent <CapsuleCollider>().enabled        = false;
            col_chest.GetComponent <BoxCollider>().enabled           = false;
            Object.Destroy(head);
            Object.Destroy(chest);
            Object.Destroy(leg);
            Object.Destroy(hand_r);
            Object.Destroy(blood_lower);
            Object.Destroy(blood_upper);
            Object.Destroy(blood_upper1);
            Object.Destroy(blood_upper2);
            Object.Destroy(blood_arm_r);
            base.gameObject.GetComponent <HERO_SETUP>().CreateLeftArm();
            break;

        case BODY_PARTS.ARM_R:
            col_upper_arm_l.GetComponent <CapsuleCollider>().enabled = false;
            col_lower_arm_l.GetComponent <CapsuleCollider>().enabled = false;
            col_thigh_l.GetComponent <CapsuleCollider>().enabled     = false;
            col_shin_l.GetComponent <CapsuleCollider>().enabled      = false;
            col_thigh_r.GetComponent <CapsuleCollider>().enabled     = false;
            col_shin_r.GetComponent <CapsuleCollider>().enabled      = false;
            col_head.GetComponent <CapsuleCollider>().enabled        = false;
            col_chest.GetComponent <BoxCollider>().enabled           = false;
            Object.Destroy(head);
            Object.Destroy(chest);
            Object.Destroy(leg);
            Object.Destroy(hand_l);
            Object.Destroy(blood_lower);
            Object.Destroy(blood_upper);
            Object.Destroy(blood_upper1);
            Object.Destroy(blood_upper2);
            Object.Destroy(blood_arm_l);
            base.gameObject.GetComponent <HERO_SETUP>().CreateRightArm();
            break;
        }
    }