예제 #1
0
    public Sprite GetAvatarSprite(EAvatar avatar)
    {
        AvatarImageReference avatarImageReference = avatarImageReferences
                                                    .FirstOrDefault(it => it.avatar == avatar);

        return(avatarImageReference?.sprite);
    }
예제 #2
0
    /// <summary>
    /// 初始化玩家
    /// </summary>
    /// <param name="level"></param>
    public void InitilaizePlayer(RoomInstance room)
    {
        if (!hasInitializePlayer)
        {
            hasInitializePlayer = true;
            EAvatar avatar = EntityManager.instance.Create <EAvatar>("default_player", room, room.hexRoom.FindClearCell(), null);
            avatar.teamComponent.SetTeamId(TeamId.Team_0);
            avatar.controllerComponent.SetController(new InputController());
            avatar.propertyComponent.SetInitProperty(new PropertyValue()
            {
                actionPriority = 10, movePointMax = 5, hpMax = 10, attackRange = 1
            });
            avatar.propertyComponent.Born();
            AddAvatar(avatar);

            avatar = EntityManager.instance.Create <EAvatar>("default_monster_0", room, room.hexRoom.FindClearCell(), null);
            avatar.teamComponent.SetTeamId(TeamId.Team_1);
            avatar.controllerComponent.SetController(new InputController());
            avatar.propertyComponent.SetInitProperty(new PropertyValue()
            {
                actionPriority = 2, movePointMax = 5, hpMax = 10, attackRange = 1
            });
            avatar.propertyComponent.Born();

            avatar = EntityManager.instance.Create <EAvatar>("default_monster_1", room, room.hexRoom.FindClearCell(), null);
            avatar.teamComponent.SetTeamId(TeamId.Team_1);
            avatar.controllerComponent.SetController(new InputController());
            avatar.propertyComponent.SetInitProperty(new PropertyValue()
            {
                actionPriority = 3, movePointMax = 5, hpMax = 10, attackRange = 1
            });
            avatar.propertyComponent.Born();
        }
    }
예제 #3
0
 public void AddAvatar(EAvatar avatar)
 {
     if (!m_AvatarList.Contains(avatar))
     {
         m_AvatarList.Add(avatar);
         GameEvent.PlayerEvent.FireOnPlayerBorn(avatar);
     }
 }
예제 #4
0
    public UIAvatarHead CreateAvatarHeadUI(EAvatar avatar)
    {
        UIAvatarHead ui = UIAvatarHead.Create();

        ui.transform.SetParent(transform, false);
        ui.SetAvatar(avatar);
        return(ui);
    }
예제 #5
0
    public bool HasEntity(Entity entity)
    {
        EAvatar avatar = entity as EAvatar;

        if (avatar != null && m_AvatarList.Contains(avatar))
        {
            return(true);
        }
        return(false);
    }
예제 #6
0
 public void ResetAvatar()
 {
     if (m_Avatar != null)
     {
         m_Avatar.controllerComponent.onTurnStart.RemoveListener(OnTurnStart);
         m_Avatar.controllerComponent.onTurnComplete.RemoveListener(OnTurnComplete);
         m_Avatar.propertyComponent.onHpChanged.RemoveListener(UpdateHp);
         m_Avatar = null;
     }
 }
예제 #7
0
 public void SetAvatar(EAvatar avatar)
 {
     ResetAvatar();
     m_Avatar = avatar;
     avatar.controllerComponent.onTurnStart.AddListener(OnTurnStart);
     avatar.controllerComponent.onTurnComplete.AddListener(OnTurnComplete);
     m_Avatar.propertyComponent.onHpChanged.AddListener(UpdateHp);
     UpdateHp(m_Avatar.propertyComponent);
     if (TurnBaseManager.instance.curTurnBase != null && TurnBaseManager.instance.curTurnBase.curController == avatar.controllerComponent)
     {
         m_CurTurn.gameObject.SetActive(true);
     }
     else
     {
         m_CurTurn.gameObject.SetActive(false);
     }
 }
예제 #8
0
 public PlayerProfile(string name, EDifficulty difficulty, EAvatar avatar)
 {
     this.Name       = name;
     this.Difficulty = difficulty;
     this.Avatar     = avatar;
 }
예제 #9
0
 public void RemoveAvatar(EAvatar avatar)
 {
     m_AvatarList.Remove(avatar);
 }
예제 #10
0
 public void ResetPlayer()
 {
     m_Avatar = null;
     gameObject.SetActive(false);
 }
예제 #11
0
 public void SetPlayer(EAvatar avatar)
 {
     m_Avatar = avatar;
     gameObject.SetActive(true);
 }
예제 #12
0
 public static void FireOnPlayerBorn(EAvatar avatar)
 {
     onPlayerBorn.Invoke(avatar);
 }