Esempio n. 1
0
    private void Awake()
    {
        AvatarControl avatarControl = GetComponent <AvatarControl>();

        Init(avatarControl.AvatarPerson);
        avatarControl.OnAvatarSpawn += Init;
    }
    private void Awake()
    {
        AvatarControl avatarControl = GetComponent <AvatarControl>();

        InitAnimator(avatarControl.AvatarPerson);
        avatarControl.OnAvatarSpawn += InitAnimator;
        avatarControl.OnDefeat      += OnDeath;
    }
Esempio n. 3
0
    public void setHumanMode()
    {
        disableModes();
        AvatarControl ac = human.getAgent().GetComponent <AvatarControl>();

        if (ac != null)
        {
            ac.activate();
        }
        human.enableForUser();
        containerAgents.sizeDelta = new Vector2(containerAgents.sizeDelta.x, 30f + human.getPanelHeight());
    }
Esempio n. 4
0
    private void disableModes()
    {
        AvatarControl ac = human.getAgent().GetComponent <AvatarControl>();

        if (ac != null)
        {
            ac.desactivate();
        }
        robot.disableForUser();
        human.disableForUser();
        godMode.disableForUser();
    }
Esempio n. 5
0
    private void RpcSetAvatar(GameObject avatar, GameObject avatarPerson)
    {
        spawnedPlayerAvatar = avatar;
        spawnedPlayerPerson = avatarPerson;

        spawnedPlayerPerson.transform.SetParent(spawnedPlayerAvatar.transform);

        if (isLocalPlayer)
        {
            UnityStandardAssets.Utility.FollowTarget camera = GameObject.FindObjectOfType <UnityStandardAssets.Utility.FollowTarget>();
            camera.target = spawnedPlayerAvatar.transform;

            avatarControl = spawnedPlayerAvatar.GetComponent <AvatarControl>();
            if (avatarControl != null)
            {
                userControlInput.SetAvatarControl(avatarControl);
                avatarControl.SetAvatarPerson(spawnedPlayerPerson);

                avatarControl.OnDefeat += YouDefeat;
            }
        }
    }
Esempio n. 6
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);
    }
Esempio n. 7
0
 void Awake()
 {
     contenderCanvas = GetComponent <Image> ();
     avatarControl   = GameObject.FindGameObjectWithTag("GameController").GetComponent <AvatarControl> ();
 }
Esempio n. 8
0
 public void SetAvatarControl(AvatarControl _avatarControl)
 {
     avatarControl = _avatarControl;
 }