/// <summary> /// 在指定位置创建召唤物. /// </summary> private static ErrorCode createCreationAt(Vector3 spawnPosition, AttackerAttr ownerAttribute, CreationType creationType, uint creationID, uint lifeTime) { BattleUnit summonedCreature = null; switch (creationType) { case CreationType.Npc: summonedCreature = SceneManager.Instance.GetCurScene().CreateSprite(new NpcInitParam() { init_pos = spawnPosition, init_dir = ownerAttribute.AttackerDirection, npc_res_id = (int)creationID, summonerAttr = ownerAttribute, lifeTime = lifeTime, }) as BattleUnit; break; case CreationType.Trap: summonedCreature = SceneManager.Instance.GetCurScene().CreateSprite(new TrapInitParam() { init_pos = spawnPosition, init_dir = ownerAttribute.AttackerDirection, summonerAttr = ownerAttribute, trapResID = creationID, lifeTime = lifeTime }) as BattleUnit; break; default: return(ErrorCode.ConfigError); } // 设置召唤物属性. if (summonedCreature != null) { // 与召唤者相同阵营. summonedCreature.SetLeague(ownerAttribute.AttackerLeague); // 免疫外界的技能任何技能效果, 而且不能被锁定, 不能阻挡子弹. if (creationType == CreationType.Trap) { summonedCreature.AddActiveFlag(ActiveFlagsDef.Inviolability, true, true); } } return(ErrorCode.Succeeded); }