public Sprite GetAvatarSprite(EAvatar avatar) { AvatarImageReference avatarImageReference = avatarImageReferences .FirstOrDefault(it => it.avatar == avatar); return(avatarImageReference?.sprite); }
/// <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(); } }
public void AddAvatar(EAvatar avatar) { if (!m_AvatarList.Contains(avatar)) { m_AvatarList.Add(avatar); GameEvent.PlayerEvent.FireOnPlayerBorn(avatar); } }
public UIAvatarHead CreateAvatarHeadUI(EAvatar avatar) { UIAvatarHead ui = UIAvatarHead.Create(); ui.transform.SetParent(transform, false); ui.SetAvatar(avatar); return(ui); }
public bool HasEntity(Entity entity) { EAvatar avatar = entity as EAvatar; if (avatar != null && m_AvatarList.Contains(avatar)) { return(true); } return(false); }
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; } }
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); } }
public PlayerProfile(string name, EDifficulty difficulty, EAvatar avatar) { this.Name = name; this.Difficulty = difficulty; this.Avatar = avatar; }
public void RemoveAvatar(EAvatar avatar) { m_AvatarList.Remove(avatar); }
public void ResetPlayer() { m_Avatar = null; gameObject.SetActive(false); }
public void SetPlayer(EAvatar avatar) { m_Avatar = avatar; gameObject.SetActive(true); }
public static void FireOnPlayerBorn(EAvatar avatar) { onPlayerBorn.Invoke(avatar); }