Exemplo n.º 1
0
 private void LoadScene(HScene scene)
 {
     sf.Reset();
     ac.Init();
     string[] onHolds = scene.GetOnHolds();
     for (int i = (int)AvatarControl.BODYS.RH; i <= (int)AvatarControl.BODYS.LF; i++)
     {
         if (!string.IsNullOrEmpty(onHolds[i]))
         {
             Transform t = holds.Find(onHolds[i]);
             if (t != null)
             {
                 Hold hold = t.gameObject.GetComponent <Hold>();
                 sf.SetFocusHold(i, hold);
                 ac.SetFixed(i, true);
             }
         }
     }
     cs.SetComments(scene.GetComments());
     if (scene.IsPose())
     {
         ik.SetPose(scene.GetPose(), scene.GetPRotate());
     }
     else
     {
         ik.InitAvatar();
     }
 }
Exemplo n.º 2
0
    private void InitAvatar(Vector3 spawnPosition, AvatarType avatarType)
    {
        switch (avatarType)
        {
        case AvatarType.DODGER:
            HealthAmount = START_HEALTH;
            healthBar.gameObject.SetActive(true);
            break;

        case AvatarType.SHOOTER:
            healthBar.gameObject.SetActive(false);
            break;

        default:
            break;
        }

        foreach (Renderer renderer in avatarModel.transform.GetComponentsInChildren <Renderer>())
        {
            if (renderer.tag == Tags.TeamColored)
            {
                renderer.material.color = Team.Color();
            }
        }
        avatarModel.transform.SetParent(transform, false);

        AvatarTypeSettings = avatarType.Settings();
        title.text         = AvatarTypeSettings.Name;

        weapon.Init(this);
        if (photonView.isMine)
        {
            AvatarControl avatarControl = gameObject.AddComponent <AvatarControl>();
            avatarControl.Init(this, avatarModel, weapon);
        }

        transform.position = spawnPosition;
        gameObject.SetActive(true);
    }