예제 #1
0
    public void SwitchPlayerCharacter()
    {
        //Save character to make other follow
        var other = _selectedCharacter;

        //Select other character
        _selectedCharacter = _characterList.FirstOrDefault(x => x != _selectedCharacter);

        //Make previously selected follow newly selected
        if (other != null)
        {
            (other.GetVisualCharacter() as Script_CharacterBehaviour).SetActiveCharacter(false);
            (other.GetVisualCharacter() as Script_CharacterBehaviour).SetFollowTarget(_selectedCharacter
                                                                                      .GetVisualCharacter().transform);
        }

        //Set selected character as active and make camera follow
        (_selectedCharacter.GetVisualCharacter() as Script_CharacterBehaviour).SetActiveCharacter(true);
        Camera.main.GetComponent <Script_FollowCamera>().SetTarget(_selectedCharacter.GetVisualCharacter().transform);
    }
 public override void Initialise()
 {
     _character     = Script_GameManager.GetInstance().CharacterManager.GetCharacters()[0];
     _baseText      = transform.GetChild(0).GetComponent <Text>();
     _itemBoostText = transform.GetChild(1).GetComponent <Text>();
 }
예제 #3
0
 public void SetCharacter(Script_Character character)
 {
     _attachedCharacter = character;
 }