// get nearest target of targetType public static Actor GetNearestTarget(World world, Actor attacker, Vector3D centerPosition, float range, ActorType targetType = ActorType.Monster) { Actor result = null; List<Actor> actors = world.QuadTree.Query<Actor>(new Circle(centerPosition.X, centerPosition.Y, range)); if (actors.Count > 1) { float distanceNearest = range; // max. range float distance = 0f; foreach (var target in actors.Where(target => ((target.ActorType == targetType) && (target != attacker) && !target.Attributes[GameAttribute.Is_NPC]))) { if ((target.World == null) || (world.GetActorByDynamicId(target.DynamicID) == null)) { // leaving world continue; } distance = ActorUtils.GetDistance(centerPosition, target.Position); if ((result == null) || (distance < distanceNearest)) { result = target; distanceNearest = distance; } } } return result; }
internal static StreamSubscriptionSpecification From(ActorType type, StreamSubscriptionAttribute attribute) { if (string.IsNullOrWhiteSpace(attribute.Source)) throw InvalidSpecification(type, "has null or whitespace only value of Source"); if (string.IsNullOrWhiteSpace(attribute.Target)) throw InvalidSpecification(type, "has null or whitespace only value of Target"); if (attribute.Filter != null && string.IsNullOrWhiteSpace(attribute.Filter)) throw InvalidSpecification(type, "has whitespace only value of Filter"); var parts = attribute.Source.Split(new[] {":"}, 2, StringSplitOptions.None); if (parts.Length != 2) throw InvalidSpecification(type, $"has invalid Source specification: {attribute.Source}"); var provider = parts[0]; var source = parts[1]; var target = attribute.Target; var filter = attribute.Filter; var isRegex = source.StartsWith("/") && source.EndsWith("/"); if (!isRegex) return new MatchExact(provider, source, target, type, filter); var pattern = source.Substring(1, source.Length - 2); return new MatchPattern(provider, pattern, target, type, filter); }
public static Func<Vector3, Vector3, ActorBase> GetSpawnMethod(ActorType actorType) { if (!_initialized) Initialize(); return _spawnMethods[actorType]; }
public static SpriteSheet CreateSpriteSheet(ActorType actorType) { if (_sheets == null) throw new InvalidOperationException("_sheets was not initialized -- need to call SpriteSheetFactory.Initialize"); return _sheets[actorType].Invoke(); }
public static GameplayStats DefaultStats(ActorType actorType) { if (actorType == ActorType.Imp) { return new GameplayStats() { Health = 500, Essence = 100, AD = 40, DP = 15, Armor = 20, DR = 15, Speed = 6, MovementRange = 3, MaximumHeightCanMove = 1 }; } else if (actorType == ActorType.Caco) { return new GameplayStats() { Health = 300, Essence = 175, AD = 20, DP = 40, Armor = 12, DR = 18, Speed = 7, MovementRange = 5, MaximumHeightCanMove = 5 }; } return Statsless(); }
public Actor Spawn(ActorType actorType) { Stack<GameObject> pool = poolDictionary[actorType]; if( pool.Count == 0 ) { Debug.Log("empty pool"+actorType); return null; } GameObject spawn = pool.Pop(); spawn.transform.parent = null; Actor actor = spawn.GetComponent<Actor>(); Bounds bounds = World.Instance.GetLiveableArea(actor.liveableArea); float xPos = bounds.center.x; float yPos = Random.Range(bounds.min.y, bounds.max.y); float zPos = Random.Range(bounds.min.z, bounds.max.z); Vector3 startPos = new Vector3(xPos, yPos, zPos); Vector3 midPos = startPos; midPos.z = 0; actor.transform.position = startPos; string actorTypeName = actorType.ToString(); if( actorTypeName.StartsWith("FISH")) { actor.transform.LookAt(midPos); } spawn.SetActive(true); actor.AfterSpawn(); return actor; }
private static ActorMeta CreateActorMeta(DiaObject diaObject, ACD acd, int actorSNO, ActorType actorType) { using (new PerformanceLogger("CreateActorMeta")) { ActorMeta actorMeta; // We only care about having accurate information on Units and Gizmos. // Everything else can just return the default. //if (actorType == ActorType.Monster && diaObject is DiaUnit || // actorType == ActorType.Gizmo && diaObject is DiaGizmo || // actorType == ActorType.Player) //{ actorMeta = new ActorMeta(diaObject, acd, actorSNO, actorType); if (Trinity.Settings.Advanced.ExportNewActorMeta && actorMeta.IsValid && !actorMeta.IsPartial) { Logger.Log("Exporting ActorMeta for {0} ({1})", acd.Name, actorSNO); WriteToLog(actorMeta); } //} //else if (actorType == ActorType.Player) //{ // actorMeta = new ActorMeta(diaObject, acd, actorSNO, actorType); //} //else //{ // actorMeta = new ActorMeta(); //} ReferenceActorMeta.Add(actorSNO, actorMeta); return actorMeta; } }
//���һ������ public static ActorData getActorData(string id, string groupid, ActorType type, ActorPro pro) { ActorData data = new ActorData(id); data.GroupID = groupid; data.ActorType = type; data.ActorPro = pro; return data; }
StreamSubscriptionSpecification(string provider, string source, string target, ActorType actor, string filter) { Provider = provider; this.source = source; this.target = target; this.filter = BuildFilter(filter, actor); receiver = BuildReceiver(target, actor); }
public Vector3 GetMovesOffset(ActorType targetType) { switch (targetType) { case ActorType.Enemy:return new Vector3(0,0,-this.GridZLength/2); case ActorType.Player: return new Vector3(0, 0, this.GridZLength / 2); } return Vector3.zero; }
internal static ActorPrototype Of(ActorType type) { var prototype = cache.Find(type); if (prototype == null) throw new InvalidOperationException( $"Can't find implementation for actor '{type}'." + "Make sure you've registered assembly containing this type"); return prototype; }
public static void Register(ActorType type) { var isActor = type.Interface.GetCustomAttribute<ActorAttribute>() != null; var isWorker = type.Interface.GetCustomAttribute<WorkerAttribute>() != null; if (isActor && isWorker) throw new InvalidOperationException( $"A type cannot be configured to be both Actor and Worker: {type}"); factories.Add(type, isWorker ? GetWorkerFactory() : GetActorFactory(type)); }
public Actor(MpqFile file) { var stream = file.Open(); Header = new Header(stream); this.Int0 = stream.ReadValueS32(); this.Type = (ActorType)stream.ReadValueS32(); this.ApperanceSNO = stream.ReadValueS32(); this.PhysMeshSNO = stream.ReadValueS32(); this.Cylinder = new AxialCylinder(stream); this.Sphere = new Sphere(stream); this.AABBBounds = new AABB(stream); var tagmap = stream.GetSerializedDataPointer(); // we need to read tagmap. /raist. stream.Position += (2*4); this.AnimSetSNO = stream.ReadValueS32(); this.MonsterSNO = stream.ReadValueS32(); var msgTriggeredEvents = stream.GetSerializedDataPointer(); this.Int1 = stream.ReadValueS32(); stream.Position += (3*4); this.V0 = new Vector3D(stream.ReadValueF32(), stream.ReadValueF32(), stream.ReadValueF32()); this.Looks = new WeightedLook[8]; for (int i = 0; i < 8; i++) { this.Looks[i] = new WeightedLook(stream); } this.PhysicsSNO = stream.ReadValueS32(); this.Int2 = stream.ReadValueS32(); this.Int3 = stream.ReadValueS32(); this.Float0 = stream.ReadValueF32(); this.Float1 = stream.ReadValueF32(); this.Float2 = stream.ReadValueF32(); this.ActorCollisionData = new int[17]; // Was 68/4 - Darklotus for (int i = 0; i < 17; i++) { this.ActorCollisionData[i] = stream.ReadValueS32(); } this.InventoryImages = new int[10]; //Was 5*8/4 - Darklotus for (int i = 0; i < 10; i++) { this.InventoryImages[i] = stream.ReadValueS32(); } // Updated based on BoyC's 010editoer template, looks like some data at the end still isnt parsed - Darklotus stream.Close(); }
public static string GetActorPath( ActorType actorType, int hospitalId = 0 ) { string path; switch ( actorType ) { case ActorType.Dashboard: path = $"{PathPrefix}/user/{DashboardActorName}"; break; case ActorType.Commander: path = $"{PathPrefix}/user/{MediWatchCommanderActorName}"; break; case ActorType.Coordinator: if ( hospitalId <= 0 ) throw new ArgumentOutOfRangeException( "hospitalId" ); path = $"{PathPrefix}/user/{MediWatchCommanderActorName}/{GetActorCoordinatorName( hospitalId )}"; break; case ActorType.Fetcher: if (hospitalId <= 0) throw new ArgumentOutOfRangeException("hospitalId"); path = $"{PathPrefix}/user/{MediWatchCommanderActorName}/{GetActorCoordinatorName(hospitalId)}/{HospitalEventFetcherActorName}"; break; case ActorType.StatAvgTimeToSeeADoctorActor: if ( hospitalId <= 0 ) throw new ArgumentOutOfRangeException( "hospitalId" ); path = $"{PathPrefix}/user/{MediWatchCommanderActorName}/{GetActorCoordinatorName( hospitalId )}/{StatAvgTimeToSeeADoctorActorName}"; break; case ActorType.StatAvgAppointmentDurationActor: if ( hospitalId <= 0 ) throw new ArgumentOutOfRangeException( "hospitalId" ); path = $"{PathPrefix}/user/{MediWatchCommanderActorName}/{GetActorCoordinatorName( hospitalId )}/{StatAvgAppointmentDurationActorName}"; break; case ActorType.StatDiseaseActor: if (hospitalId <= 0) throw new ArgumentOutOfRangeException("hospitalId"); path = $"{PathPrefix}/user/{MediWatchCommanderActorName}/{GetActorCoordinatorName(hospitalId)}/{StatDiseaseActorName}"; break; case ActorType.StatEstimatedTimeToSeeADoctorActor: if (hospitalId <= 0) throw new ArgumentOutOfRangeException("hospitalId"); path = $"{PathPrefix}/user/{MediWatchCommanderActorName}/{GetActorCoordinatorName(hospitalId)}/{StatEstimatedTimeToSeeADoctorActorName}"; break; default: throw new ArgumentOutOfRangeException( "actorType" ); } return path; }
public static ActorMeta GetOrCreateActorMeta(DiaObject diaObject, ACD acd, int actorSNO, ActorType actorType) { using (new PerformanceLogger("GetOrCreateActorMeta")) { ActorMeta actorMeta; if (!ReferenceActorMeta.TryGetValue(actorSNO, out actorMeta)) { actorMeta = CreateActorMeta(diaObject, acd, actorSNO, actorType); } return actorMeta; } }
public EntityTypeDescriptor(string name, bool isStatic, Type modelType, ActorType[] restrictTo, Type interfaceType, IEnumerable<OperationDescriptor> operations, IEnumerable<PropertyDescriptor> properties, IEnumerable<EventDescriptor> events) { this.Name = name; this.Static = isStatic; this.Model = modelType; this.RestrictTo = restrictTo; this.Interface = interfaceType; this.Operations = (IDictionary<string, OperationDescriptor>) new Dictionary<string, OperationDescriptor>(); foreach (OperationDescriptor operationDescriptor in operations) this.Operations.Add(operationDescriptor.Name, operationDescriptor); this.Properties = (IDictionary<string, PropertyDescriptor>) new Dictionary<string, PropertyDescriptor>(); foreach (PropertyDescriptor propertyDescriptor in properties) this.Properties.Add(propertyDescriptor.Name, propertyDescriptor); this.Events = (IDictionary<string, EventDescriptor>) new Dictionary<string, EventDescriptor>(); foreach (EventDescriptor eventDescriptor in events) this.Events.Add(eventDescriptor.Name, eventDescriptor); }
static Func<object, bool> BuildFilter(string filter, ActorType actor, ActorPrototype prototype) { if (filter == null) return item => prototype.DeclaresHandlerFor(item.GetType()); if (filter == "*") return item => true; if (!filter.EndsWith("()")) throw new InvalidOperationException("Filter string value is missing '()' function designator"); var method = GetStaticMethod(filter, actor.Implementation); if (method == null) throw new InvalidOperationException("Filter function should be a static method"); return (Func<object, bool>)method.CreateDelegate(typeof(Func<object, bool>)); }
static Func<string, object> GetActorFactory(ActorType type) { var factory = GrainFactory(); var attribute = type.Interface.GetCustomAttribute<ActorAttribute>() ?? new ActorAttribute(); switch (attribute.Placement) { case Placement.Random: return id => factory.GetGrain<IA0>(id);; case Placement.PreferLocal: return id => factory.GetGrain<IA1>(id);; case Placement.DistributeEvenly: return id => factory.GetGrain<IA2>(id);; default: throw new ArgumentOutOfRangeException(); } }
public static bool CanInteract(ActorType a, ActorType b) { if( IsFish(a) ) { return IsFish(b) || IsHook(b) || IsFood(b); } if( IsHook(a) ) { return IsFish(b) || IsBoat(b); } if( IsFood(a) ) { return IsFish(b); } if( IsBoat(a) ) { return IsHook(b); } return false; }
//public List<IActivatable> Targets { get; set; } public ActivatableTile(string id, ActorType actorType, StatusType statusType, Transform3D transform, OurEffectParameters effectParameters, Model model, bool isBlocking, ETileType tileType) : base( id, actorType, statusType, transform, effectParameters, model, isBlocking, tileType) { }
public IsActor(ActorType type) { this.Type = type; }
/* * * CHECK_BUFF_NONE = 0, * CHECK_BUFF_CLASS, * CHECK_BUFF_SUB_CLASS, * CHECK_BUFF_CLASS_ID, * CHECK_BUFF_TEMPLATE_ID, * CHECK_BUFF_DAMAGE_PRO, */ public static bool Add( sdActorInterface castActor, sdActorInterface target, SkillEffect effect, Transform customTrans, int skillID) { if (!castActor.CheckBuff(effect.bySelfCheckType, effect.dwSelfBuffID)) { return(false); } if (target != null) { if (!target.CheckBuff(effect.byTgtCheckType, effect.dwTgtBuffID)) { return(false); } int monsterTypeFlag = effect.byMonsterBodyTypeFlag; ActorType actorType = target.GetActorType(); if (actorType == ActorType.AT_Monster || actorType == ActorType.AT_Pet) { sdGameMonster monster = (sdGameMonster)target; int monsterType = (int)monster.Property["BodyType"]; if ((monsterTypeFlag & (1 << monsterType)) == 0) { return(false); } } } if (Random.Range(0, 10000) > effect.dwProbability) { return(false); } sdEffectOperation.OpParameter param = new sdEffectOperation.OpParameter(); param.id = effect.dwOperationID; param.data = effect.dwOperationData; param.data1 = effect.dwOperationData1; param.data2 = skillID; param.layer = 1; param.doType = (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_START; param.attackActor = castActor; param.targetActor = null; if (effect.byFlag != 0) { if (effect.byFlag == 1) { param.targetActor = castActor; } else if (effect.byFlag == 2) { param.targetActor = target; } } if (castActor != null) { param.trans = castActor.transform; } if (customTrans != null) { param.trans = customTrans; } return(sdEffectOperation.Do(param.targetActor, param)); }
public static ActorSingleton shared(ActorType type) { return(shared(type.ToString())); }
//广播消息 void OnMsgSyncActor_BS2C(PacketReader p, object state) { //Debug.Log("OnMsgPlayerEnterScene_BS2C"); int sobID = p.ReadInt32(); int syncType = p.ReadInt32(); int sobClassType = p.ReadInt32(); int sobTag = p.ReadInt32(); int dataLen = p.ReadInt32(); //Debug.LogWarning("OnMsgSyncActor_BS2C,sobID:" + sobID + ",syncType:" + syncType + ",sobTag:" + sobTag); switch ((ENSyncActorType)syncType) { case ENSyncActorType.enSyncViewable: { //别人-可见 ActorType type = ActorType.enPlayer; if ((int)ENSobTag.enSobNpc == sobTag) { //npc type = ActorType.enNPC; } Actor selfActor = ActorManager.Singleton.CreatePureActor(type, sobID, CSItemGuid.Zero, 0); if (selfActor != null) { int index = p.Index; selfActor.Props.Deserialize(p); selfActor.OnInitProps(); //再次Deserialize,是因为在OnInitProps时props被覆盖了 p.Seek(index, System.IO.SeekOrigin.Begin); selfActor.Props.Deserialize(p); selfActor.OnInitSkillBag(); selfActor.CreateNeedModels(); selfActor.InitName(); if (selfActor.IsActorExit) { selfActor.HideMe(); } else { selfActor.UnhideMe(new Vector3(selfActor.PositionX, 0, selfActor.PositionZ)); } selfActor.SelfAI = new AIServerActor(); selfActor.SelfAI.Owner = selfActor; if ((int)ENSobTag.enSobNpc != sobTag) { Debug.Log("player enter scene,id:" + selfActor.ID + ",name:" + selfActor.Name); // 添加到小地图中 UIMap.GetInstance().ShowWindow(); Map.Singleton.AddPoint(selfActor); } selfActor.UpdateHPBar(); } } break; case ENSyncActorType.enSyncRemoveView: { //别人-不可见 ; } break; case ENSyncActorType.enSyncSelf: { //自己 ActorType type = ActorType.enMain; CSItemGuid guid = CSItemGuid.Zero; Actor self = null; bool isNotifyUI = false; if (sobTag == (int)ENSobTag.enChiefPlayer) { guid = Team.Singleton.Chief.Guid; self = ActorManager.Singleton.Chief; isNotifyUI = true; } else if (sobTag == (int)ENSobTag.enDeputyPlayer) { guid = Team.Singleton.Deputy.Guid; self = ActorManager.Singleton.Deputy; } else if (sobTag == (int)ENSobTag.enSupportPlayer) { type = ActorType.enSwitch; guid = Team.Singleton.Support.Guid; self = ActorManager.Singleton.Support; } else if (sobTag == (int)ENSobTag.enComradePlayer) { type = ActorType.enFollow; guid = Team.Singleton.Comrade.Guid; self = ActorManager.Singleton.Comrade; } if (self == null) { self = ActorManager.Singleton.CreatePureActor(type, sobID, guid, 0); } else { if (sobTag != (int)ENSobTag.enChiefPlayer) { ActorManager.Singleton.ModifyActorID(self.ID, sobID); self.SetID(sobID); } } if (self != null) { int idInTable = self.IDInTable; self.m_isDeposited = true; self.SetSobTag(sobTag); int index = p.Index; self.Props.Deserialize(p); self.OnInitProps(); if (sobTag == (int)ENSobTag.enChiefPlayer) { if (idInTable != 0 && idInTable != self.IDInTable) { ActorManager.Singleton.ReleaseActor(self.ID); self = ActorManager.Singleton.CreatePureActor(type, sobID, guid, self.IDInTable); if (self == null) { Debug.LogError("create chief player fail"); return; } self.m_isDeposited = true; self.SetSobTag(sobTag); } else { ActorManager.Singleton.ModifyActorID(self.ID, sobID); self.SetID(sobID); } } //再次Deserialize,是因为在OnInitProps时props被覆盖了 p.Seek(index, System.IO.SeekOrigin.Begin); self.Props.Deserialize(p); self.OnInitSkillBag(isNotifyUI); self.CreateNeedModels(); if (sobTag == (int)ENSobTag.enChiefPlayer) { ActorManager.Singleton.SetChief(self); ActorManager.Singleton.RefreshAllName(); // 添加到小地图中 UIMap.GetInstance().ShowWindow(); Map.Singleton.AddPoint(self); if (self.IsActorExit) { self.HideMe(); (self as MainPlayer).ActorExit(); } else { self.UnhideMe(new Vector3(self.PositionX, 0, self.PositionZ)); MainGame.Singleton.MainCamera.MoveAtOnce(self); } self.NotifyChanged((int)Actor.ENPropertyChanged.enMainHead, EnMainHeadType.enInitActor); //设置优先选择的目标类型 (self as MainPlayer).m_firstTargetType = ActorType.enPlayer; } else if (sobTag == (int)ENSobTag.enDeputyPlayer) { ActorManager.Singleton.SetDeputy(self); // 添加到小地图中 UIMap.GetInstance().ShowWindow(); Map.Singleton.AddPoint(self); if (self.IsActorExit) { self.HideMe(); (self as MainPlayer).ActorExit(); } else { self.UnhideMe(new Vector3(self.PositionX, 0, self.PositionZ)); MainGame.Singleton.MainCamera.MoveAtOnce(self); //self.NotifyChanged((int)Actor.ENPropertyChanged.enMainHead, EnMainHeadType.enSwitchActor); } self.NotifyChanged((int)Actor.ENPropertyChanged.enMainHead, EnMainHeadType.enInitActor); //设置优先选择的目标类型 (self as MainPlayer).m_firstTargetType = ActorType.enPlayer; } else if (sobTag == (int)ENSobTag.enSupportPlayer) { ActorManager.Singleton.SetSupport(self); self.HideMe(); } else if (sobTag == (int)ENSobTag.enComradePlayer) { ActorManager.Singleton.SetComrade(self); self.HideMe(); //同伴先隐藏自己 } self.InitName(); self.UpdateHPBar(); } } break; } }
public void Equip(ActorType actorType = ActorType.API) { // Only equip EVA kerbals. if (!prefabModule || inventory.invType != ModuleKISInventory.InventoryType.Eva) { Debug.LogWarningFormat("Cannot equip item from inventory type: {0}", inventory.invType); return; } if (quantity > 1) { ScreenMessaging.ShowPriorityScreenMessage("Cannot equip stacked items"); UISounds.PlayBipWrong(); return; } Debug.LogFormat("Equip item {0} in mode {1}", availablePart.title, equipMode); // Check skill if needed. Skip the check in sandbox modes. if (HighLogic.CurrentGame.Mode != Game.Modes.SANDBOX && HighLogic.CurrentGame.Mode != Game.Modes.SCIENCE_SANDBOX && !String.IsNullOrEmpty(prefabModule.equipSkill)) { bool skillFound = false; List <ProtoCrewMember> protoCrewMembers = inventory.vessel.GetVesselCrew(); foreach (var expEffect in protoCrewMembers[0].experienceTrait.Effects) { if (expEffect.ToString().Replace("Experience.Effects.", "") == prefabModule.equipSkill) { skillFound = true; break; } } if (!skillFound) { if (actorType == ActorType.Player) { ScreenMessaging.ShowPriorityScreenMessage( "This item can only be used by a kerbal with the skill : {0}", prefabModule.equipSkill); UISounds.PlayBipWrong(); } return; } } // Check if slot is already occupied. if (equipSlot != null) { KIS_Item equippedItem = inventory.GetEquipedItem(equipSlot); if (equippedItem != null) { if (equippedItem.carriable && actorType == ActorType.Player) { ScreenMessaging.ShowPriorityScreenMessage( "Cannot equip item, slot <{0}> already used for carrying {1}", equipSlot, equippedItem.availablePart.title); UISounds.PlayBipWrong(); return; } equippedItem.Unequip(); } } if (equipMode == EquipMode.Model) { GameObject modelGo = availablePart.partPrefab.FindModelTransform("model").gameObject; equippedGameObj = UnityEngine.Object.Instantiate(modelGo); foreach (Collider col in equippedGameObj.GetComponentsInChildren <Collider>()) { UnityEngine.Object.DestroyImmediate(col); } evaTransform = null; var skmrs = new List <SkinnedMeshRenderer>( inventory.part.GetComponentsInChildren <SkinnedMeshRenderer>()); foreach (SkinnedMeshRenderer skmr in skmrs) { if (skmr.name != prefabModule.equipMeshName) { continue; } foreach (Transform bone in skmr.bones) { if (bone.name == prefabModule.equipBoneName) { evaTransform = bone.transform; break; } } } if (!evaTransform) { Debug.LogError("evaTransform not found ! "); UnityEngine.Object.Destroy(equippedGameObj); return; } } if (equipMode == EquipMode.Part || equipMode == EquipMode.Physic) { evaTransform = null; var skmrs = new List <SkinnedMeshRenderer>( inventory.part.GetComponentsInChildren <SkinnedMeshRenderer>()); foreach (SkinnedMeshRenderer skmr in skmrs) { if (skmr.name != prefabModule.equipMeshName) { continue; } foreach (Transform bone in skmr.bones) { if (bone.name == prefabModule.equipBoneName) { evaTransform = bone.transform; break; } } } if (!evaTransform) { Debug.LogError("evaTransform not found ! "); return; } var alreadyEquippedPart = inventory.part.FindChildPart(availablePart.name); if (alreadyEquippedPart) { Debug.LogFormat("Part {0} already found on eva, use it as the item", availablePart.name); equippedPart = alreadyEquippedPart; OnEquippedPartReady(equippedPart); } else { Vector3 equipPos = evaTransform.TransformPoint(prefabModule.equipPos); Quaternion equipRot = evaTransform.rotation * Quaternion.Euler(prefabModule.equipDir); equippedPart = KIS_Shared.CreatePart( partNode, equipPos, equipRot, inventory.part, inventory.part, srcAttachNodeId: "srfAttach", onPartReady: OnEquippedPartReady, createPhysicsless: equipMode != EquipMode.Physic); } if (equipMode == EquipMode.Part) { equippedGameObj = equippedPart.gameObject; } } if (prefabModule.equipRemoveHelmet) { inventory.SetHelmet(false); } if (actorType == ActorType.Player) { UISoundPlayer.instance.Play(prefabModule.moveSndPath); } equipped = true; prefabModule.OnEquip(this); }
public MatchExact(string provider, string source, string target, ActorType actor, string filter) : base(provider, source, target, actor, filter) {}
internal static void Register(ActorType type) { cache.Add(type, Define(type.Implementation)); }
public ActorSpawner(ActorType p_type, int p_row, int p_column) { type = p_type; row = p_row; column = p_column; }
// void DamageCharacterInWater () { // int cur_map_x = 0; // int cur_map_y = 0; // GameActor target_actor; // for ( int i = 0; i < entities_.Count; ++i ) { // target_actor = (GameActor)entities_[i]; // cur_map_x = (int)target_actor.map_pos.x; // cur_map_y = (int)target_actor.map_pos.y; // NodeType type = NavigationMap.GetInstance().GetNodeType ( cur_map_y, cur_map_x ); // if ( type == NodeType.blocked ) { // target_actor.ReduceHealth ( GameSettings.GetInstance().WATER_DAMAGE ); // // if ( !target_actor.isAlive() ) { // if ( target_actor.Type() == ActorType.human ) { // PlayAudioHumanDie(); // } else { // PlayAudioDinoDie(); // } // } // } // } // } public void AddActorSpawner(ActorType type, int row, int column) { actor_spawners_.Add(new ActorSpawner(type, row, column)); }
public PlayerEntityData(int entityId, int typeId, ActorType actorType, BattleCampType campType, bool battleState) : base(entityId, typeId, actorType, campType) { BattleState = battleState; }
public GoBacknProtocol(byte windowSize, int timeout, int ackTimeout, string fileName, ActorType actorType, ITransmissionSupport transmissionSupport) : base(windowSize, timeout, ackTimeout, fileName, actorType, transmissionSupport) { _communicationThread = new Thread(Protocol); _communicationThread.Start(); Console.WriteLine( string.Format("Started the data link layer thread of the {0} (Thread Id: {1})", actorType, _communicationThread.ManagedThreadId)); }
public PrimitiveObject(string id, ActorType actorType, StatusType statusType, Transform3D transform3D, EffectParameters effectParameters, IVertexData vertexData) : base(id, actorType, statusType, transform3D, effectParameters) { this.vertexData = vertexData; }
/// <summary> /// Returns true if the world has an actor with given dynamicId and type. /// </summary> /// <param name="dynamicID">The dynamicId of the actor.</param> /// <param name="matchType">The type of the actor.</param> /// <returns></returns> public bool HasActor(uint dynamicID, ActorType matchType) { var actor = this.GetActorByDynamicId(dynamicID, matchType); return(actor != null); }
public static void LoadSettings() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Files.fileSettings); XmlNode root = xmlDoc.FirstChild; XmlNode hotkeys = root["HotKeys"]; if (hotkeys != null) { foreach (XmlAttribute atr in hotkeys.Attributes) { Settings.HotKeys.List[atr.Name] = atr.Value; } } XmlNode autoFish = root["AutoFish"]; if (autoFish != null) { foreach (XmlAttribute atr in autoFish.Attributes) { Settings.AutoFish.List[atr.Name] = atr.Value; } } XmlNode autoRestore = root["AutoRestore"]; if (autoRestore != null) { foreach (XmlAttribute atr in autoRestore.Attributes) { Settings.AutoRestore.List[atr.Name] = atr.Value; } } XmlNode uiHack = root["UIHack"]; if (uiHack != null) { foreach (XmlAttribute atr in uiHack.Attributes) { Settings.UIHack.List[atr.Name] = atr.Value; } } XmlNode autoPot = root["AutoPotion"]; if (autoPot != null) { foreach (XmlAttribute atr in autoPot.Attributes) { Settings.AutoPotion.List[atr.Name] = atr.Value; } } XmlNode autoItemRegister = root["AutoItemRegister"]; if (autoItemRegister != null) { foreach (XmlAttribute atr in autoItemRegister.Attributes) { Settings.AutoItemRegister.List[atr.Name] = atr.Value; } XmlNode items = autoItemRegister["Items"]; if (items != null) { List <ItemRegisterObject> lItems = new List <ItemRegisterObject>(); foreach (XmlNode item in items.ChildNodes) { bool enabled = false; if (item.Attributes.GetNamedItem("Enabled") != null) { enabled = Convert.ToBoolean(Convert.ToInt32(item.Attributes["Enabled"].Value)); } int itemId = 0; if (item.Attributes.GetNamedItem("ItemId") != null) { itemId = Convert.ToInt32(item.Attributes["ItemId"].Value); } int sellValue = 0; if (item.Attributes.GetNamedItem("SellValue") != null) { sellValue = Convert.ToInt32(item.Attributes["SellValue"].Value); } lItems.Add(new ItemRegisterObject(enabled, itemId, sellValue)); } Settings.AutoItemRegister.Items = lItems; } } XmlNode autoItemBuy = root["AutoItemBuy"]; if (autoItemBuy != null) { foreach (XmlAttribute atr in autoItemBuy.Attributes) { Settings.AutoItemBuy.List[atr.Name] = atr.Value; } XmlNode items = autoItemBuy["Items"]; if (items != null) { List <ItemBuyObject> lItems = new List <ItemBuyObject>(); foreach (XmlNode item in items.ChildNodes) { bool enabled = false; if (item.Attributes.GetNamedItem("Enabled") != null) { enabled = Convert.ToBoolean(Convert.ToInt32(item.Attributes["Enabled"].Value)); } int itemId = 0; if (item.Attributes.GetNamedItem("ItemId") != null) { itemId = Convert.ToInt32(item.Attributes["ItemId"].Value); } int enchantLevel = 0; if (item.Attributes.GetNamedItem("EnchantLevel") != null) { enchantLevel = Convert.ToInt32(item.Attributes["EnchantLevel"].Value); } int sessionMax = 0; if (item.Attributes.GetNamedItem("SessionMax") != null) { sessionMax = Convert.ToInt32(item.Attributes["SessionMax"].Value); } long maxPrice = 0; if (item.Attributes.GetNamedItem("MaxPrice") != null) { maxPrice = Convert.ToInt32(item.Attributes["MaxPrice"].Value); } bool isStack = false; if (item.Attributes.GetNamedItem("IsStack") != null) { isStack = Convert.ToBoolean(Convert.ToInt32(item.Attributes["IsStack"].Value)); } lItems.Add(new ItemBuyObject(enabled, itemId, enchantLevel, sessionMax, maxPrice, isStack)); } Settings.AutoItemBuy.Items = lItems; } } XmlNode overlay = root["Overlay"]; if (overlay != null) { foreach (XmlAttribute atr in overlay.Attributes) { Settings.Overlay.List[atr.Name] = atr.Value; } } XmlNode actors = overlay["Actors"]; if (actors != null) { List <ActorObject> lActors = new List <ActorObject>(); foreach (XmlNode actor in actors.ChildNodes) { if (actor.NodeType == XmlNodeType.Comment) { continue; } bool enabled = false; if (actor.Attributes.GetNamedItem("Enabled") != null) { enabled = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["Enabled"].Value)); } ActorType actorType = ActorType.ActorType_All; if (actor.Attributes.GetNamedItem("Type") != null) { actorType = (ActorType)Enum.Parse(typeof(ActorType), actor.Attributes["Type"].Value); } int[] actorIDs = new int[] { 0 }; if (actor.Attributes.GetNamedItem("IDs") != null) { List <int> lActorIDs = new List <int>(); var idSplit = actor.Attributes["IDs"].Value.Split(','); foreach (var id in idSplit) { lActorIDs.Add(Convert.ToInt32(id)); } actorIDs = lActorIDs.ToArray(); } int[] color = new int[] { 255, 0, 0, 255 }; if (actor.Attributes.GetNamedItem("Color") != null) { List <int> lColor = new List <int>(); var colorSplit = actor.Attributes["Color"].Value.Split(','); foreach (var cc in colorSplit) { lColor.Add(Convert.ToInt32(cc)); } color = lColor.ToArray(); } bool drawCircle = true; if (actor.Attributes.GetNamedItem("DrawCircle") != null) { Convert.ToBoolean(Convert.ToInt32(actor.Attributes["DrawCircle"].Value)); } bool drawLine = false; if (actor.Attributes.GetNamedItem("DrawLine") != null) { drawLine = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["DrawLine"].Value)); } bool showName = false; if (actor.Attributes.GetNamedItem("ShowName") != null) { showName = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["ShowName"].Value)); } bool showActorId = false; if (actor.Attributes.GetNamedItem("ShowActorId") != null) { showActorId = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["ShowActorId"].Value)); } int thickness = 1; if (actor.Attributes.GetNamedItem("Thickness") != null) { thickness = Convert.ToInt32(actor.Attributes["Thickness"].Value); } bool showDistance = false; if (actor.Attributes.GetNamedItem("ShowDistance") != null) { showDistance = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["ShowDistance"].Value)); } bool showOnWorldMap = false; if (actor.Attributes.GetNamedItem("ShowOnWorldMap") != null) { showOnWorldMap = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["ShowOnWorldMap"].Value)); } bool showLevel = false; if (actor.Attributes.GetNamedItem("ShowLevel") != null) { showLevel = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["ShowLevel"].Value)); } bool showHp = false; if (actor.Attributes.GetNamedItem("ShowHp") != null) { showHp = Convert.ToBoolean(Convert.ToInt32(actor.Attributes["ShowHp"].Value)); } int minDistance = 0; if (actor.Attributes.GetNamedItem("MinDistance") != null) { minDistance = Convert.ToInt32(actor.Attributes["MinDistance"].Value); } int maxDistance = 0; if (actor.Attributes.GetNamedItem("MaxDistance") != null) { maxDistance = Convert.ToInt32(actor.Attributes["MaxDistance"].Value); } lActors.Add(new ActorObject(enabled, actorType, actorIDs, color, drawCircle, drawLine, thickness, showName, showActorId, showDistance, showOnWorldMap, minDistance, maxDistance, showLevel, showHp)); } Settings.Overlay.Actors = lActors; } XmlNode waypoints = overlay["Waypoints"]; if (waypoints != null) { List <WaypointObject> lWaypoints = new List <WaypointObject>(); foreach (XmlNode waypoint in waypoints.ChildNodes) { if (waypoint.NodeType == XmlNodeType.Comment) { continue; } bool enabled = false; if (waypoint.Attributes.GetNamedItem("Enabled") != null) { enabled = Convert.ToBoolean(Convert.ToInt32(waypoint.Attributes["Enabled"].Value)); } int[] color = new int[] { 255, 0, 0, 255 }; if (waypoint.Attributes.GetNamedItem("Color") != null) { List <int> lColor = new List <int>(); var colorSplit = waypoint.Attributes["Color"].Value.Split(','); foreach (var cc in colorSplit) { lColor.Add(Convert.ToInt32(cc)); } color = lColor.ToArray(); } int thickness = 1; if (waypoint.Attributes.GetNamedItem("Thickness") != null) { thickness = Convert.ToInt32(waypoint.Attributes["Thickness"].Value); } float[] position = new float[] { 0f, 0f, 0f }; if (waypoint.Attributes.GetNamedItem("Position") != null) { List <float> lColor = new List <float>(); var colorSplit = waypoint.Attributes["Position"].Value.Split(','); foreach (var cc in colorSplit) { lColor.Add(Convert.ToSingle(cc)); } position = lColor.ToArray(); } string name = ""; if (waypoint.Attributes.GetNamedItem("Name") != null) { name = waypoint.Attributes["Name"].Value; } lWaypoints.Add(new WaypointObject(enabled, color, thickness, position, name)); } Settings.Overlay.Waypoints = lWaypoints; } XmlNode speedHack = root["SpeedHack"]; if (speedHack != null) { foreach (XmlAttribute atr in speedHack.Attributes) { Settings.SpeedHack.List[atr.Name] = atr.Value; } XmlNode horse = speedHack["Horse"]; XmlNode ship = speedHack["Ship"]; XmlNode player = speedHack["Player"]; if (player != null) { foreach (XmlAttribute atr in horse.Attributes) { Settings.SpeedHack.Horse.List[atr.Name] = atr.Value; } foreach (XmlAttribute atr in ship.Attributes) { Settings.SpeedHack.Ship.List[atr.Name] = atr.Value; } foreach (XmlAttribute atr in player.Attributes) { Settings.SpeedHack.Player.List[atr.Name] = atr.Value; } } } XmlNode autoprocessing = root["AutoProcessing"]; if (autoprocessing != null) { foreach (XmlAttribute atr in autoprocessing.Attributes) { Settings.AutoProcessing.List[atr.Name] = atr.Value; } } XmlNode pItems = autoprocessing["Items"]; if (pItems != null) { List <ProcessingObject> lpItems = new List <ProcessingObject>(); foreach (XmlNode item in pItems.ChildNodes) { if (item.NodeType == XmlNodeType.Comment) { continue; } bool enabled = false; if (item.Attributes.GetNamedItem("Enabled") != null) { enabled = Convert.ToBoolean(Convert.ToInt32(item.Attributes["Enabled"].Value)); } int itemId = 0; if (item.Attributes.GetNamedItem("ItemId") != null) { itemId = Convert.ToInt32(item.Attributes["ItemId"].Value); } ProcessingType pType = ProcessingType.Chopping; if (item.Attributes.GetNamedItem("ProcessingType") != null) { pType = (ProcessingType) Enum.Parse(typeof(ProcessingType), item.Attributes["ProcessingType"].Value); } int minCount = 10; if (item.Attributes.GetNamedItem("MinCount") != null) { minCount = Convert.ToInt32(item.Attributes["MinCount"].Value); } int[] resultItemIds = new int[] { 0 }; if (item.Attributes.GetNamedItem("ResultItemIds") != null) { List <int> lb = new List <int>(); var idSplit = item.Attributes["ResultItemIds"].Value.Split(','); foreach (var id in idSplit) { lb.Add(Convert.ToInt32(id)); } resultItemIds = lb.ToArray(); } string comment = ""; if (item.Attributes.GetNamedItem("Comment") != null) { comment = item.Attributes["Comment"].Value; } lpItems.Add(new ProcessingObject(enabled, itemId, pType, minCount, resultItemIds, comment)); } Settings.AutoProcessing.Items = lpItems; } SaveSettings(); }
/// <summary> /// 设置 <see cref="Actor" /> 类型 /// </summary> /// <param name="type">Actor 类型</param> protected void SetUpType(ActorType type) { actorTypeDebug = type; actorType = type; }
private uint GetNewActorID(ActorType type) { // get an unused actorID uint newID = 0; uint startID = 0; if (type == ActorType.PC) { newID = this.nextPcId; startID = this.nextPcId; } else { if (type == ActorType.NPC) { newID = this.nextNpcId; startID = this.nextNpcId; } else { newID = this.nextItemId; startID = this.nextItemId; } } while (this.actorsByID.ContainsKey(newID)) { newID++; if(newID >= ID_BORDER2 && type == ActorType.PC) newID = 1; if(newID >= UInt32.MaxValue) newID = ID_BORDER + 1; if (newID == startID) return 0; } if (type == ActorType.PC) this.nextPcId = newID + 1; else if(type==ActorType .NPC) this.nextNpcId = newID + 1; else this.nextItemId = newID + 1; return newID; }
//no target specified e.g. we detect by object type not specific target address public ZoneObject(string id, ActorType actorType, Transform3D transform, bool isImpenetrable, EventParameters eventParameters) : this(id, actorType, transform, isImpenetrable, eventParameters, null) { }
public TrinityActor(ACD acd, ActorType type) : base(acd, type) { Attributes = new AttributesWrapper(CommonData); ObjectHash = HashGenerator.GenerateObjectHash(Position, ActorSnoId, InternalName); }
public Actor3D(string id, ActorType actorType, Transform3D transform, StatusType statusType) : base(id, actorType, statusType) { this.transform = transform; }
//used when we don't want to specify status type public DrawnActor3D(string id, ActorType actorType, Transform3D transform, EffectParameters effectParameters) : this(id, actorType, transform, effectParameters, StatusType.Drawn | StatusType.Update) { }
public DrawnActor3D(string id, ActorType actorType, StatusType statusType, Transform3D transform3D, EffectParameters effectParameters) : base(id, actorType, statusType, transform3D) { this.effectParameters = effectParameters; }
public SelectiveRepeatProtocol(byte windowSize, int timeout, int ackTimeout, string fileName, ActorType actorType, ITransmissionSupport transmissionSupport) : base(windowSize, timeout, ackTimeout, fileName, actorType, transmissionSupport) { _NR_BUFS = (byte)((_MAX_SEQ + 1) / 2); _no_nak = true; _oldest_frame = (byte)(_MAX_SEQ + 1); _communicationThread = new Thread(Protocol); _communicationThread.Start(); Console.WriteLine(string.Format("Started the data link layer thread of the {0} (Thread Id: {1})", actorType, _communicationThread.ManagedThreadId)); }
static ActorPrototype CreatePrototype(ActorType type) => new ActorPrototype(type);
public PickupCollidableObject(string id, ActorType actorType, Transform3D transform, BasicEffect effect, Color color, float alpha, Texture2D texture, Model model, EventParameters eventParameters) : base(id, actorType, transform, effect, color, alpha, texture, model) { this.eventParameters = eventParameters; }
ActorPrototype(ActorType type) { gc = new GC(type.Implementation); dispatcher = new Dispatcher(type.Implementation); this.type = type; }
//private List<> OtherBars { get; set; } public Actor(ActorType thing) { type = thing; }
internal static IEnumerable<StreamSubscriptionSpecification> From(ActorType type) { return type.Implementation .GetCustomAttributes<StreamSubscriptionAttribute>(inherit: true) .Select(a => From(type, a)); }
public ActorTypeFilter(ActorType actorType) { this.actorType = actorType; }
public MatchPattern(string provider, string source, string target, ActorType actor, string filter) : base(provider, source, target, actor, filter) { matcher = new Regex(source, RegexOptions.Compiled); generator = new Regex(@"(?<placeholder>\{[^\}]+\})", RegexOptions.Compiled); }
public override string ToString() { return(String.Format("SnoID[{0}] ActorType[{1}] EntryType[{2}] Name[{3}]", SnoId, ActorType.ToString(), EntryType.ToString(), InternalName)); }
static Exception InvalidSpecification(ActorType type, string error) { string message = $"StreamSubscription attribute defined on '{type}' {error}"; return new InvalidOperationException(message); }
public Camera3D(string id, ActorType actorType, Transform3D transform, ProjectionParameters projectionParameters, Viewport viewport) : this(id, actorType, transform, projectionParameters, viewport, 1) { }
static Func<IActorSystem, string, Func<object, Task>> BuildReceiver(string target, ActorType type) { if (!target.EndsWith("()")) { return (system, id) => { var receiver = system.ActorOf(type, id); return receiver.Tell; }; } var method = GetStaticMethod(target, type.Implementation); if (method == null) throw new InvalidOperationException("Target function should be a static method"); var selector = (Func<object, string>)method.CreateDelegate(typeof(Func<object, string>)); return (system, id) => (item => system.ActorOf(type, selector(item)).Tell(item)); }
public void Equip(ActorType actorType = ActorType.API) { // Only equip EVA kerbals. if (!prefabModule || inventory.invType != ModuleKISInventory.InventoryType.Eva) { DebugEx.Warning("Cannot equip item from inventory type: {0}", inventory.invType); return; } if (quantity > 1) { ScreenMessaging.ShowPriorityScreenMessage(CannotEquipItemStackedMsg); UISounds.PlayBipWrong(); return; } DebugEx.Info("Equip item {0} in mode {1}", availablePart.title, equipMode); // Check if the skill is needed. Skip the check in the sandbox modes. if (HighLogic.CurrentGame.Mode != Game.Modes.SANDBOX && HighLogic.CurrentGame.Mode != Game.Modes.SCIENCE_SANDBOX && !String.IsNullOrEmpty(prefabModule.equipSkill)) { bool skillFound = false; List <ProtoCrewMember> protoCrewMembers = inventory.vessel.GetVesselCrew(); foreach (var expEffect in protoCrewMembers[0].experienceTrait.Effects) { if (expEffect.ToString().Replace("Experience.Effects.", "") == prefabModule.equipSkill) { skillFound = true; break; } } if (!skillFound) { if (actorType == ActorType.Player) { ScreenMessaging.ShowPriorityScreenMessage( CannotEquipRestrictedToSkillMsg.Format(prefabModule.equipSkill)); UISounds.PlayBipWrong(); } return; } } // Check if slot is already occupied. if (equipSlot != null) { KIS_Item equippedItem = inventory.GetEquipedItem(equipSlot); if (equippedItem != null) { if (equippedItem.carriable && actorType == ActorType.Player) { ScreenMessaging.ShowPriorityScreenMessage( CannotEquipAlreadyCarryingMsg.Format(equipSlot, equippedItem.availablePart.title)); UISounds.PlayBipWrong(); return; } equippedItem.Unequip(); } } // Find the bone for this item to follow. evaTransform = KISAddonConfig.FindEquipBone(inventory.part.transform, prefabModule.equipBoneName); if (evaTransform == null) { return; // Cannot equip! } if (equipMode == EquipMode.Model) { var modelGo = availablePart.partPrefab.FindModelTransform("model").gameObject; equippedGameObj = UnityEngine.Object.Instantiate(modelGo); equippedGameObj.transform.parent = inventory.part.transform; foreach (Collider col in equippedGameObj.GetComponentsInChildren <Collider>()) { UnityEngine.Object.DestroyImmediate(col); } } else { var alreadyEquippedPart = inventory.part.FindChildPart(availablePart.name); if (alreadyEquippedPart) { DebugEx.Info("Part {0} already found on eva, use it as the item", availablePart.name); equippedPart = alreadyEquippedPart; // This magic is copied from the KervalEVA.OnVesselGoOffRails() method. // There must be at least 3 fixed frames delay before updating the colliders. AsyncCall.WaitForPhysics( equippedPart, 3, () => false, failure: () => OnEquippedPartReady(equippedPart)); if (equipMode == EquipMode.Part) { // Ensure the part doesn't have rigidbody and is not affected by physics. // The part may not like it. equippedPart.PhysicsSignificance = 1; // Disable physics on the part. UnityEngine.Object.Destroy(equippedPart.rb); } } else { Vector3 equipPos = evaTransform.TransformPoint(prefabModule.equipPos); Quaternion equipRot = evaTransform.rotation * Quaternion.Euler(prefabModule.equipDir); equippedPart = KIS_Shared.CreatePart( partNode, equipPos, equipRot, inventory.part, coupleToPart: inventory.part, srcAttachNodeId: "srfAttach", onPartReady: OnEquippedPartReady, createPhysicsless: equipMode != EquipMode.Physic); } if (equipMode == EquipMode.Part) { equippedGameObj = equippedPart.gameObject; } } // Hide the stock meshes if the custom helmet is equipped. if (equipSlot == HelmetSlotName) { var kerbalModule = inventory.part.FindModuleImplementing <KerbalEVA>(); if (kerbalModule.helmetTransform != null) { for (var i = 0; i < kerbalModule.helmetTransform.childCount; i++) { kerbalModule.helmetTransform.GetChild(i).gameObject.SetActive(false); } if (equippedGameObj != null) { equippedGameObj.transform.parent = kerbalModule.helmetTransform; } } else { DebugEx.Warning("Kerbal model doesn't have helmet transform: {0}", inventory); } } if (actorType == ActorType.Player) { UISoundPlayer.instance.Play(prefabModule.moveSndPath); } equipped = true; prefabModule.OnEquip(this); inventory.StartCoroutine(AlignEquippedPart()); }
public void Assign(ActorStatusComponent values) { Type = values.Type; BaseMaxHP = values.BaseMaxHP; BaseHP = values.BaseHP; BaseMoveSpeed = values.BaseMoveSpeed; BaseAttackSpeed = values.BaseAttackSpeed; BaseDamage = values.BaseDamage; MaxHPModifiers = values.MaxHPModifiers; HPModifiers = values.HPModifiers; MoveSpeedModifiers = values.MoveSpeedModifiers; AttackSpeedModifiers = values.AttackSpeedModifiers; DamageModifiers = values.DamageModifiers; MaxHP = values.MaxHP; HP = values.HP; MoveSpeed = values.MoveSpeed; AttackSpeed = values.AttackSpeed; Damage = values.Damage; }
public ActorInitiative(AbstractActor actor) { //SkillBasedInit.Logger.Log($"Initializing ActorInitiative for {actor.DisplayName} with GUID {actor.GUID}."); if (actor.GetType() == typeof(Mech)) { this.type = ActorType.Mech; } else if (actor.GetType() == typeof(Vehicle)) { this.type = ActorType.Vehicle; } else { this.type = ActorType.Turret; } // --- UNIT IMPACTS --- // Static initiative from tonnage float tonnage = UnitHelper.GetUnitTonnage(actor); int tonnageMod = UnitHelper.GetTonnageModifier(tonnage); // Any special modifiers by type int typeMod = UnitHelper.GetTypeModifier(actor); // Any modifiers that come from the chassis/mech/vehicle defs int componentsMod = UnitHelper.GetNormalizedComponentModifier(actor); // Modifier from the engine int engineMod = UnitHelper.GetEngineModifier(actor); // --- PILOT IMPACTS --- Pilot pilot = actor.GetPilot(); PilotHelper.LogPilotStats(pilot); // Normalize skills so that values above 10 don't screw the system this.gunneryEffectMod = PilotHelper.GetGunneryModifier(pilot); this.gutsEffectMod = PilotHelper.GetGutsModifier(pilot); this.injuryBounds = PilotHelper.GetInjuryBounds(pilot); this.pilotingEffectMod = PilotHelper.GetPilotingModifier(pilot); this.randomnessBounds = PilotHelper.GetRandomnessBounds(pilot); this.tacticsEffectMod = PilotHelper.GetTacticsModifier(pilot); int pilotTagsMod = PilotHelper.GetTagsModifier(pilot); this.calledShotMod = PilotHelper.GetCalledShotModifier(pilot); this.vigilianceMod = PilotHelper.GetVigilanceModifier(pilot); // --- COMBO IMPACTS -- // Determine the melee modifier int[] meleeMods = PilotHelper.GetMeleeModifiers(pilot, tonnage); this.meleeAttackMod = meleeMods[0]; this.meleeDefenseMod = meleeMods[1]; Mod.Log.Debug($"Actor:{actor.DisplayName}_{pilot.Name} has meleeAttackMod:{meleeAttackMod} meleeDefenseMod:{meleeDefenseMod}"); // Log the full view for testing roundInitBase = tonnageMod; roundInitBase += typeMod; roundInitBase += componentsMod; roundInitBase += engineMod; roundInitBase += tacticsEffectMod; roundInitBase += pilotTagsMod; Mod.Log.Info($"Actor:{actor.DisplayName}_{pilot.Name} has " + $"roundInitBase:{roundInitBase} = (tonnage:{tonnageMod} + typeMod:{typeMod} + components:{componentsMod} + engine:{engineMod} " + $"tactics:{tacticsEffectMod} + pilotTags:{pilotTagsMod}) " + $"randomness:({randomnessBounds[0]}-{randomnessBounds[1]}) " + $"injuryBounds:({injuryBounds[0]}-{injuryBounds[1]}) " + $"gutsMod:{gutsEffectMod} pilotingMod:{pilotingEffectMod} tacticsMod:{tacticsEffectMod}"); }
public static ActorCommonData get_SelectedAtackableAcd(out double distance, out ActorType type) { distance = 0; type = ActorType.Invalid; try { var ListB = Engine.Current.ObjectManager.x9E0_PlayerInput.Dereference().x00_ListB_Of_ActorId.ToList(); if (ListB.Count() > 0) { var selectedActorId = ListB.ToList()[0]; var selectedtype = Engine.Current.ObjectManager.x9E0_PlayerInput.Dereference().x14_StructStart_Min56Bytes; if (selectedtype == 44580) { List<A_Collector.ACD> acdcontainer; lock (A_Collection.Environment.Actors.AllActors) acdcontainer = A_Collection.Environment.Actors.AllActors.ToList(); var acd = acdcontainer.FirstOrDefault(x => x._ACD.x08C_ActorId == selectedActorId); if (acd != null) { distance = acd.Distance; type = acd._ACD.x184_ActorType; return acd._ACD; } } } return null; } catch { return null; } }
private void UpdatePickups(float elapsedSeconds) { Vector3 vector3 = Vector3.UnitY * this.CameraManager.Radius / this.CameraManager.AspectRatio; foreach (PickupState pickupState in this.PickupStates) { TrileInstance trileInstance = pickupState.Instance; InstancePhysicsState physicsState = trileInstance.PhysicsState; ActorType type = trileInstance.Trile.ActorSettings.Type; if (!physicsState.Paused && (physicsState.ShouldRespawn || trileInstance.Enabled && trileInstance != this.PlayerManager.CarriedInstance && (!physicsState.Static || pickupState.TouchesWater))) { this.TryFloat(pickupState, elapsedSeconds); if (!physicsState.Vanished && (!pickupState.TouchesWater || !ActorTypeExtensions.IsBuoyant(type))) { physicsState.Velocity += (float)(3.15000009536743 * (double)this.CollisionManager.GravityFactor * 0.150000005960464) * elapsedSeconds * Vector3.Down; } bool grounded = trileInstance.PhysicsState.Grounded; Vector3 center = physicsState.Center; this.PhysicsManager.Update((ISimplePhysicsEntity)physicsState, false, pickupState.Group == null && (!physicsState.Floating || !FezMath.AlmostEqual(physicsState.Velocity.X, 0.0f) || !FezMath.AlmostEqual(physicsState.Velocity.Z, 0.0f))); pickupState.LastMovement = physicsState.Center - center; if (physicsState.NoVelocityClamping) { physicsState.NoVelocityClamping = false; physicsState.Velocity = Vector3.Zero; } if (pickupState.AttachedAOs != null) { foreach (ArtObjectInstance artObjectInstance in pickupState.AttachedAOs) { artObjectInstance.Position += pickupState.LastMovement; } } if (((double)pickupState.LastGroundedCenter.Y - (double)trileInstance.Position.Y) * (double)Math.Sign(this.CollisionManager.GravityFactor) > (double)vector3.Y) { physicsState.Vanished = true; } else if (this.LevelManager.Loops) { while ((double)trileInstance.Position.Y < 0.0) { trileInstance.Position += this.LevelManager.Size * Vector3.UnitY; } while ((double)trileInstance.Position.Y > (double)this.LevelManager.Size.Y) { trileInstance.Position -= this.LevelManager.Size * Vector3.UnitY; } } if (physicsState.Floating && physicsState.Grounded && !physicsState.PushedUp) { physicsState.Floating = pickupState.TouchesWater = (double)trileInstance.Position.Y <= (double)this.LevelManager.WaterHeight - 13.0 / 16.0 + (double)pickupState.FloatMalus; } physicsState.ForceNonStatic = false; if (ActorTypeExtensions.IsFragile(type)) { if (!trileInstance.PhysicsState.Grounded) { pickupState.FlightApex = Math.Max(pickupState.FlightApex, trileInstance.Center.Y); } else if (!trileInstance.PhysicsState.Respawned && (double)pickupState.FlightApex - (double)trileInstance.Center.Y > (double)PickupsHost.BreakHeight(type)) { this.PlayBreakSound(type, trileInstance.Position); trileInstance.PhysicsState.Vanished = true; this.ParticleSystemManager.Add(new TrixelParticleSystem(this.Game, new TrixelParticleSystem.Settings() { ExplodingInstance = trileInstance, EnergySource = new Vector3?(trileInstance.Center - Vector3.Normalize(pickupState.LastVelocity) * trileInstance.TransformedSize / 2f), ParticleCount = 30, MinimumSize = 1, MaximumSize = 8, GravityModifier = 1f, Energy = 0.25f, BaseVelocity = pickupState.LastVelocity * 0.5f })); this.LevelMaterializer.CullInstanceOut(trileInstance); if (type == ActorType.Vase) { trileInstance.PhysicsState = (InstancePhysicsState)null; this.LevelManager.ClearTrile(trileInstance); break; } else { trileInstance.Enabled = false; trileInstance.PhysicsState.ShouldRespawn = true; } } } this.TryPushHorizontalStack(pickupState, elapsedSeconds); if (physicsState.Static) { pickupState.LastMovement = pickupState.LastVelocity = physicsState.Velocity = Vector3.Zero; physicsState.Respawned = false; } if (physicsState.Vanished) { physicsState.ShouldRespawn = true; } if (physicsState.ShouldRespawn && this.PlayerManager.Action != ActionType.FreeFalling) { physicsState.Center = pickupState.OriginalCenter + new Vector3(1.0 / 1000.0); physicsState.UpdateInstance(); physicsState.Velocity = Vector3.Zero; physicsState.ShouldRespawn = false; pickupState.LastVelocity = Vector3.Zero; pickupState.TouchesWater = false; physicsState.Floating = false; physicsState.PushedDownBy = (TrileInstance)null; trileInstance.Enabled = false; trileInstance.Hidden = true; physicsState.Ground = new MultipleHits <TrileInstance>() { NearLow = this.LevelManager.ActualInstanceAt(physicsState.Center - trileInstance.Trile.Size.Y * Vector3.UnitY) }; ServiceHelper.AddComponent((IGameComponent) new GlitchyRespawner(ServiceHelper.Game, trileInstance)); } physicsState.UpdateInstance(); this.LevelManager.UpdateInstance(trileInstance); if (!grounded && trileInstance.PhysicsState.Grounded && (double)Math.Abs(pickupState.LastVelocity.Y) > 0.0500000007450581) { float num1 = FezMath.Dot(pickupState.LastVelocity, FezMath.RightVector(this.CameraManager.Viewpoint)); float val1 = FezMath.Saturate(pickupState.LastVelocity.Y / (-0.2f * (float)Math.Sign(this.CollisionManager.GravityFactor))); AnimatedTexture animation; if (ActorTypeExtensions.IsHeavy(trileInstance.Trile.ActorSettings.Type)) { if ((double)val1 > 0.5) { animation = this.largeDust; } else { animation = this.smallDust; val1 *= 2f; } } else { animation = this.smallDust; } float num2 = Math.Max(val1, 0.4f); this.SpawnDust(trileInstance, num2, animation, (double)num1 >= 0.0, (double)num1 <= 0.0); if (animation == this.largeDust && (double)num1 != 0.0) { this.SpawnDust(trileInstance, num2, this.smallDust, (double)num1 <0.0, (double)num1> 0.0); } SoundEffectExtensions.EmitAt(this.thudSound, trileInstance.Position, (float)((double)num2 * -0.600000023841858 + 0.300000011920929), num2); } if (physicsState.Grounded && physicsState.Ground.First.PhysicsState != null) { physicsState.Ground.First.PhysicsState.PushedDownBy = trileInstance; } pickupState.LastVelocity = trileInstance.PhysicsState.Velocity; } } }