/// <summary> /// 移除npc身上特效 /// </summary> /// <param name="npcId"></param> public bool RemoveCollectNpcEffectByNpcId(uint npcId) { List <int> linkIdList; if (m_dicCollectNpcEffectLinkId.TryGetValue(npcId, out linkIdList)) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return(false); } INPC npc = es.FindNPC(npcId); if (npc == null) { return(false); } for (int i = 0; i < linkIdList.Count; i++) { EntitySystem.EntityHelper.RemoveEffect(npc, linkIdList[i]); } return(true); } return(false); }
/// <summary> /// 是宠物或者召唤物 /// </summary> /// <param name="en"></param> /// <returns></returns> public static bool IsPetAndSummon(IEntity en) { IControllerSystem cs = EntitySystem.m_ClientGlobal.GetControllerSystem(); if (cs == null) { return(false); } //IControllerHelper ch = cs.GetControllerHelper(); //if ( ch == null ) //{ // return false; //} //if ( ch.NpcIsPet( en ) ) //{ // return true; //} INPC npc = en as INPC; if (npc != null) { if (npc.IsPet()) { return(true); } if (npc.IsSummon()) { return(true); } } return(false); }
private static void Advance(INPC e, GameTime time) { Again: Vector3 v1 = e.Path.Current; e.Path.NextNode(); Vector3 v2 = e.Path.Current; Vector3 v = (v2 - v1); if (v.Length() == 0) { goto Again;//Duplicate, should not exist } v.Normalize(); if (v.X != 0 || v.Z != 0) { float angle = (float)Math.Atan(v.X / v.Z); if (v.X == 0 && v.Z < 0) { angle += MathHelper.Pi; } Vector3 newrot = new Vector3(0, angle, 0); if (!newrot.Equals(e.Rotation)) { e.StopWalking(time); } e.Rotation = newrot; } }
public static void HandleCollision(INPC character, IUsableItem item, Enumerations.CollisionSide collisionSide) { character.TakeDamage(item.DamageAmount); item.IsDestructable = true; SoundManager.Instance.PlayEnemyHit(); switch (collisionSide) { case Enumerations.CollisionSide.Right: RightCollision(character); break; case Enumerations.CollisionSide.Left: LeftCollision(character); break; case Enumerations.CollisionSide.Top: UpCollision(character); break; case Enumerations.CollisionSide.Bottom: DownCollision(character); break; default: break; } }
public INPC getNPC(string name) { INPC npc = null; RoomNpcs.TryGetValue(name, out npc); return(npc); }
/// <summary> /// Subscribes to the PropertyChanged event in a manner that avoids /// memory leaks. /// </summary> /// <param name="vm"> The INPC that we want to subscribe to.</param> /// <param name="targetObject"> The object whose property we'll be updating.</param> /// <param name="handler"> The action to be performed when the event triggers. </param> public static void WeakSubscribe ( INPC vm, object targetObject, PropertyChangedEventHandler handler ) { // If this vm is not in the weak subscription system yet, add it. WeakKeyDictionary <object, HandlerList> vmTableEntry; if (!dispatchTable.TryGetValue(vm, out vmTableEntry)) { vmTableEntry = new WeakKeyDictionary <object, HandlerList>(); dispatchTable.Add(vm, vmTableEntry); vm.PropertyChanged += DispatchWeakEvent; } // If a handler list for this object doesn't exist yet, make one. HandlerList handlerList; if (!vmTableEntry.TryGetValue(targetObject, out handlerList)) { handlerList = new HandlerList(); vmTableEntry.Add(targetObject, handlerList); } // Add the handler to the list. handlerList.Add(handler); }
//**// //**ОСНОВЫЕ МЕТОДЫ**// public static void ShowWindow(INPC NPCIn) // Метод переключения на эту форму { user.dialogWindow.Show(); NPC = NPCIn; InitializeForm(); UpdateNPC(); }
public PlayerNPCCollision(IPlayer player, INPC npc, String attackDirection, LegendOfZelda game) { this.player = player; this.npc = npc; this.attackDirection = attackDirection; this.game = game; }
public void UnregisterNPC(INPC npc) { if (_npcs.Remove(npc)) { Debug.Log($"Unregistered NPC {npc.Id}"); } }
public void RegisterNPC(INPC npc) { if (_npcs.Add(npc)) { Debug.Log($"Registered NPC {npc.Id}"); } }
public IEntity FindTeamerByRange(uint range) { INPC npc = FindNearstEntity <INPC>(new TeamNPCCondition(range)); IPlayer player = FindNearstEntity <IPlayer>(new TeamPlayerCondition(range)); return(GetNearstEntity(npc, player)); }
public void OnPetLevelUP(stLevelUpPetUserCmd_S cmd) { IPet pet = GetPetByThisID(cmd.id); if (pet != null) { pet.SetProp((int)CreatureProp.Level, cmd.lv); pet.SetProp((int)PetProp.LevelExp, cmd.exp); pet.SetProp((int)PetProp.MaxPoint, cmd.max_point); UpdatePetProp(); string txt = DataManager.Manager <TextManager>().GetLocalFormatText(LocalTextType.Talk_System_zhanhunshengji, GetPetName(pet), cmd.lv); ChatDataManager.SendToChatSystem(txt); INPC npc = GetNpcByPetID(cmd.id); if (npc != null) { npc.SetProp((int)CreatureProp.Level, cmd.lv); stPropUpdate prop = new stPropUpdate(); prop.uid = npc.GetUID(); prop.nPropIndex = (int)CreatureProp.Level; prop.newValue = (int)cmd.lv; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_PROPUPDATE, prop); } } }
public static void HandleCollision(ILink link, INPC enemy, Enumerations.CollisionSide collisionSide) { Contract.Requires(link != null); Contract.Requires(enemy != null); //Contract.Requires(collision != null); link.DamagePlayer(enemy.DamageAmount); SoundManager.Instance.PlayLinkHit(); link.Knockback = true; link.CollisionLocation = link.Position; switch (collisionSide) { case Enumerations.CollisionSide.Left: LeftCollision(link); break; case Enumerations.CollisionSide.Right: RightCollision(link); break; case Enumerations.CollisionSide.Top: UpCollision(link); break; case Enumerations.CollisionSide.Bottom: DownCollision(link); break; default: break; } }
void ChangePetBody(uint suitID, uint petID) { PetDataManager pm = DataManager.Manager <PetDataManager>(); if (pm != null) { //if (pm.CurFightingPet != 0) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es != null) { INPC npc = es.FindNPC(petID); if (npc != null) { if (suitID != 0) { SuitDataBase sdb = GameTableManager.Instance.GetTableItem <SuitDataBase>(suitID, 1); if (sdb != null) { Client.ChangeBody cb = new Client.ChangeBody(); cb.resId = (int)sdb.resid; cb.modleScale = sdb.sceneModleScale; npc.SendMessage(EntityMessage.EntityCommand_Change, cb); } } else { npc.SendMessage(EntityMessage.EntityCommand_Restore); } } } } } }
/// <summary> /// 通过玩家id获取所属的npc /// </summary> /// <param name="playerID"></param> /// <returns></returns> public void GetOwnNpcByPlayerID(uint playerID, ref List <INPC> lstNPC) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } if (lstNPC == null) { return; } lstNPC.Clear(); es.FindAllEntity <INPC>(ref m_npcList); for (int i = 0; i < m_npcList.Count; i++) { INPC npc = m_npcList[i]; if (npc != null) { int masterID = npc.GetProp((int)NPCProp.Masterid); if (masterID == playerID) { lstNPC.Add(npc); } } } m_npcList.Clear(); }
/// <summary> ///释放技能表现效果 /// </summary> /// <param name="skill_id"></param> /// <param name="skillPart"></param> /// <param name="attackActionID"></param> void FreeSkill(uint skill_id, ISkillPart skillPart, uint attackActionID) { if(m_bHideOtherPlayer) { if(IsMainPlayer()) { m_caster.InitCastSkill(skill_id, skillPart, attackActionID); } else { INPC npc = m_Master as INPC; if (npc != null) { if (!npc.IsMainPlayerSlave()) { m_caster.InitCastSkill(skill_id, skillPart, attackActionID); } } } } else { m_caster.InitCastSkill(skill_id, skillPart, attackActionID); } }
/** * Initiates an interaction between the player and an NPC. * @params: (Player) current player of the game speaking. * @return: (bool) true/false value whether game is over or not. **/ public override bool execute(Player player) { string notify = "PlayerSpeak_"; string name = ""; if (this.Words.Count == 0) { player.outputMessage("\nSpeak to who?"); return(false); } else { while (this.Words.Count != 0) { name += this.Words.Dequeue() + " "; } name = name.TrimEnd(); notify += name; INPC npc = player.currentRoom.getNPC(name); if (npc != null) { NotificationCenter.Instance.postNotification(new Notification(notify, player)); NotificationCenter.Instance.postNotification(new Notification("FirstMerchantInteraction", this)); player.outputMessage("\nType \"walk away\" to end the interaction"); } else { player.outputMessage("\nThat person is not in this room?\n"); player.outputMessage(player.currentRoom.description()); } } return(false); }
public static void HandleCollision(INPC character, IUsableItem item, Enumerations.CollisionSide collisionSide) { character.TakeDamage(item.DamageAmount); item.IsDestructable = true; UsableWoodenSword.projectile = null; UsableWoodenSword.IsMoving = false; // Room.CurrentRoomSpriteEffects.Add(new EffectSwordBeamCollision(item.Position)); SoundManager.Instance.PlayEnemyHit(); switch (collisionSide) { case Enumerations.CollisionSide.Right: RightCollision(character); break; case Enumerations.CollisionSide.Left: LeftCollision(character); break; case Enumerations.CollisionSide.Top: UpCollision(character); break; case Enumerations.CollisionSide.Bottom: DownCollision(character); break; default: break; } }
void SkillEvent(int eventID, object param) { if (ClientGlobal.Instance().MainPlayer == null) { return; } long userUID = ClientGlobal.Instance().MainPlayer.GetUID(); if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) { stEntityDead ed = (stEntityDead)param; if (ed.uid == userUID) { DeleteFightPet(0); } if (CurPet != null) { INPC npc = GetNpcByPetID(CurPet.GetID()); if (npc != null) { if (ed.uid == npc.GetUID()) { DeleteFightPet(0); } } } } }
public ColorType GetNpcNameColor(IEntity entity) { ColorType nameColor = ColorType.JSXT_NpcCheFu; INPC npc = entity as INPC; if (npc.IsCanAttackNPC()) { if (npc.IsMercenary()) { nameColor = ColorType.JSXT_Enemy_White; } else { if (npc.IsPet()) { nameColor = ColorType.JSXT_ZhanHun; } else if (npc.IsSummon()) { nameColor = ColorType.JSXT_ZhaoHuanWu; } else { int level = MainPlayerHelper.GetPlayerLevel(); int monsterLv = entity.GetProp((int)CreatureProp.Level); int levelGap = GameTableManager.Instance.GetGlobalConfig <int>("MonsterWarningLevelGap"); if (level + levelGap < monsterLv) { nameColor = ColorType.JSXT_Enemy_Red; } else { nameColor = ColorType.JSXT_Enemy_White; } } } } else { table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)entity.GetProp((int)Client.EntityProp.BaseID)); if (npcdb != null) { if (npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT) { nameColor = ColorType.JSXT_CaiJiWu; } else if (npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_TRANSFER || npcdb.dwType == (int)GameCmd.enumNpcType.NPC_TYPE_FUNCTION) { nameColor = ColorType.JSXT_ChuanSongZhen; } else { nameColor = ColorType.White; } } } return(nameColor); }
// Use this for initialization void Start() { mortar = GetComponentInChildren<IMortar>(); npc = GetComponent<INPC>(); castdar = GetComponentInChildren<Castdar>(); mortar.OnProjectileHit += new OnProjectileHitHandler(projectileHit); }
public int CalculateOffsetY(INPC npc) { var multiplier = npc.IsFacing(EODirection.Left, EODirection.Up) ? -1 : 1; var walkAdjust = npc.IsActing(NPCActionState.Walking) ? WalkHeightFactor * npc.GetWalkFrame() : 0; //walkAdjust * multiplier is the old ViewAdjustY return(npc.X * HeightFactor + npc.Y * HeightFactor + walkAdjust * multiplier); }
public NotifyPropertyChangedTest() { _store = new DictionaryConfigStore(); _interface = new ConfigurationBuilder <INPC>() .UseConfigStore(_store) .Build(); }
public int CalculateOffsetX(INPC npc) { var multiplier = npc.IsFacing(EODirection.Left, EODirection.Down) ? -1 : 1; var walkAdjust = npc.IsActing(NPCActionState.Walking) ? WalkWidthFactor * npc.GetWalkFrame() : 0; //walkAdjust * multiplier is the old ViewAdjustX return(npc.X * WidthFactor - npc.Y * WidthFactor + walkAdjust * multiplier); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); link = new Link(contentManager.Load <Texture2D>("LinkSpriteSheet"), contentManager); block = new Block(contentManager.Load <Texture2D>("Dungeon_Tileset")); npc = new Stalfos(520, 222, 16, 16, contentManager.Load <Texture2D>("Dungeon_Enemies")); }
public static int GetAttackFrame(this INPC npc) { if (!npc.IsActing(NPCActionState.Attacking)) { return(0); } return(npc.Frame - NPCFrame.Attack1 + 1); }
//**// //**ОСНОВЫЕ МЕТОДЫ**// public static void ShowWindow(INPC NPCIn) // Метод переключения на эту форму { user.fightWindow.Show(); NPC = NPCIn; InitializeForm(); UpdateNPC(); user.actor.inFight = true; }
internal WpfTester() { _subjectUnderTest = new TestWpf(); _anotherSubjectUnderTest = new TestWpf(); SymmetricObjects(); _subjectUnderTest = new TestWpf(); _guineaPig = new INPC(); AsymmetricObjects(); }
public INPCRenderer CreateRendererFor(INPC npc) { return(new NPCRenderer(_endlessGameProvider, _characterRendererProvider, _enfFileProvider, _npcSpriteSheet, _renderOffsetCalculator, npc)); }
/// <summary> /// 城战基本信息 进入副本时下发一次 /// </summary> /// <param name="cmd"></param> public void OnCityWarBaseInfo(GameCmd.stCityWarBaseInfoClanUserCmd_S cmd) { m_bEnterCityWar = true;// m_lstCityWarClanId = cmd.clans_id; m_lstCityWarClanName = cmd.clans_name; m_lstCityWarTotemBaseId = cmd.towers_base_id; m_lstCityWarTotemClanId = cmd.tower_clan_id; //图腾 m_lstCityWarTotem = new List <CityWarTotem>(); for (int i = 0; i < m_lstCityWarTotemBaseId.Count; i++) { CityWarTotem cityWarTotem = new CityWarTotem(); cityWarTotem.npcBaseId = m_lstCityWarTotemBaseId[i]; cityWarTotem.clanId = m_lstCityWarTotemClanId[i]; m_lstCityWarTotem.Add(cityWarTotem); //设置实体clanID; IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { INPC npc = es.FindNPCByBaseId((int)cityWarTotem.npcBaseId); if (npc != null) { uint clanId = cityWarTotem.clanId; int clanIdLow = (int)(clanId & 0x0000ffff); int clanIdHigh = (int)(clanId >> 16); npc.SetProp((int)Client.CreatureProp.ClanIdLow, clanIdLow); npc.SetProp((int)Client.CreatureProp.ClanIdHigh, clanIdHigh); //npc.SetProp((int)Client.CreatureProp.ClanId, (int)cityWarTotem.clanId); } } } //氏族名称 for (int i = 0; i < m_lstCityWarTotem.Count; i++) { if (m_lstCityWarTotem[i].clanId == 0) { continue; } int clanIndex = m_lstCityWarClanId.IndexOf(m_lstCityWarTotem[i].clanId); string clanName = clanIndex < m_lstCityWarClanName.Count ? m_lstCityWarClanName[clanIndex] : ""; m_lstCityWarTotem[i].clanName = clanName; } if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.CityWarFightingPanel)) { DataManager.Manager <UIPanelManager>().SendMsg(PanelID.CityWarFightingPanel, UIMsgID.eCityWarInfoUpdate, null); } }
public void SpawnVillagers() { m_Beggar = m_Factory.GetNPC(NPCType.Beggar); m_Farmer = m_Factory.GetNPC(NPCType.Farmer); m_Shopowner = m_Factory.GetNPC(NPCType.Shopowner); m_Guard = m_Factory.GetNPC(NPCType.Guard); m_Beggar.Speak(); m_Farmer.Speak(); m_Shopowner.Speak(); m_Guard.Speak(); }
public bool NPCMove(INPC npc, int direction) { //TODO: Hier noch die einfügen, ob sich der NPC dort hinbewegen kann //NPC bewegen (genaue Distanz) int distance = 0; int[] targetCoords = npc.getPositon(); //TODO: hier ist noch ein Bug: die Distanz ist zu hoch if (direction == 0) { targetCoords[1]++; distance = ( gameStatics.GameGraphicObject.getPosition( tileIDs[targetCoords[0],targetCoords[1]])[1] - npc.getPixelPosition()[1]); } if (direction == 3) { targetCoords[1]--; distance = gameStatics.GameGraphicObject.getPosition( tileIDs[targetCoords[0],targetCoords[1]])[0] + npc.getPixelPosition()[0]; } if (direction == 1) { targetCoords[1]++; distance = gameStatics.GameGraphicObject.getPosition( tileIDs[targetCoords[0],targetCoords[1]])[1] + npc.getPixelPosition()[1]; } if (direction == 2) { targetCoords[1]++; distance = gameStatics.GameGraphicObject.getPosition( tileIDs[targetCoords[0], targetCoords[1]])[0] + npc.getPixelPosition()[0]; } //NPC bewegen: npc.move(distance, direction, moveSpeed); //Zurückgeben, dass der NPC bewegt wurde: return true; }
public void RegistrationCitizen(INPC npc) { AddNpc(npc); }
private void AddNpc(INPC pNPC) { npcs.Add(pNPC); }
// Use this for initialization void Start() { npc = GetComponent<INPC>(); gun = GetComponentInChildren<Gun>(); }
// Use this for initialization void Start() { npc = GetComponent<INPC>(); }
// Use this for initialization void Start() { InvokeRepeating ("updateSteerDirection", 0, 0.2f); npc = GetComponent<INPC>(); gun = GetComponentInChildren<Gun>(); castdar = GetComponentInChildren<Castdar>(); if(npc.gameObject.tag == "Team1") myTeam = Team.RED; else myTeam = Team.BLUE; logger = GameObject.Find ("Observer").GetComponent<Logger>(); GameObject redFlag = GameObject.FindGameObjectWithTag("Red Flag"); GameObject blueFlag = GameObject.FindGameObjectWithTag("Blue Flag"); GameObject redBase = GameObject.Find("Red Base"); GameObject blueBase = GameObject.Find("Blue Base"); if(myTeam == Team.RED) { enemyFlag = blueFlag; enemyBasePos = blueFlag.transform.position; enemyBaseRadius = blueBase; myFlag = redFlag; myBasePos = redFlag.transform.position; myBaseRadius = redBase; } else { enemyFlag = redFlag; enemyBasePos = redFlag.transform.position; enemyBaseRadius = redBase; myFlag = blueFlag; myBasePos = blueFlag.transform.position; myBaseRadius = blueBase; } }
public void DeleteNPC(INPC npc) { RemoveNpc(npc); }
public void UnRegister(INPC enemy) { enemies.Remove(enemy); }
private void RemoveNpc(INPC pNPC) { npcs.Remove (pNPC); }
private static void Advance(INPC e, GameTime time) { Again: Vector3 v1 = e.Path.Current; e.Path.NextNode(); Vector3 v2 = e.Path.Current; Vector3 v = (v2 - v1); if (v.Length() == 0) goto Again;//Duplicate, should not exist v.Normalize(); if (v.X != 0 || v.Z != 0) { float angle = (float)Math.Atan(v.X / v.Z); if (v.X == 0 && v.Z < 0) angle += MathHelper.Pi; Vector3 newrot = new Vector3(0, angle, 0); if (!newrot.Equals(e.Rotation)) e.StopWalking(time); e.Rotation = newrot; } }
public void Register(INPC enemy) { enemies.AddFirst(enemy); enemy.Position = enemy.Path.Current; enemy.StopWalking(Manager.Game.GameTime); }