// For assignment, use IPhxControlableInstance.Assign()! public void SetPawn(IPhxControlableInstance pawn) { Debug.Assert(pawn.GetController() == this); Pawn = pawn; ViewDirection = Pawn.GetInstance().transform.forward; }
void OnTriggerExit(Collider other) { IPhxControlableInstance inst = other.gameObject.GetComponent <IPhxControlableInstance>(); if (inst != null) { OnLeave?.Invoke(inst); } }
void OnEffectRegionLeave(IPhxControlableInstance other) { PhxSoldier soldier = other as PhxSoldier; if (soldier != null) { Soldiers.Remove(soldier); } }
void OnEffectRegionEnter(IPhxControlableInstance other) { PhxSoldier soldier = other as PhxSoldier; if (soldier != null) { Soldiers.Add(soldier); } }
void AddToCapture(IPhxControlableInstance other) { PhxPawnController controller = other.GetController(); if (controller != null) { CaptureControllers.Add(controller); controller.CapturePost = this; RefreshCapture(); } }
public void RemoveFromCapture(IPhxControlableInstance other) { PhxPawnController controller = other.GetController(); if (controller != null) { CaptureControllers.Remove(controller); controller.CapturePost = null; RefreshCapture(); } }
void SetActive(PhxCharacterItem item, PhxClass cl, IPhxControlableInstance preview) { foreach (PhxCharacterItem it in Items) { it.SetActive(false); } item.SetActive(true); CurrentSelection = cl; foreach (PhxInstance inst in UnitPreviews) { inst.gameObject.SetActive(false); } preview.GetInstance().gameObject.SetActive(true); IPhxControlableInstance animPreview = preview as IPhxControlableInstance; if (animPreview != null) { animPreview.PlayIntroAnim(); } }
public void Add(PhxClass cl) { if (cl.ClassType != EEntityClassType.GameObjectClass) { Debug.LogError($"Cannot add odf class '{cl.Name}' as item to character selection!"); return; } // CSP = Char Select Preview IPhxControlableInstance preview = RTS.CreateInstance(cl, cl.Name + "_CSP" + nameCounter++, Vector3.zero, Quaternion.identity, false, GAME.CharSelectTransform) as IPhxControlableInstance; preview.Fixate(); UnitPreviews.Add(preview); PhxCharacterItem item = Instantiate(ItemPrefab, ListContents); item.OnClicked += () => { SetActive(item, cl, preview); }; item.SetHeaderText(cl.LocalizedName); string detailText = ""; PhxSoldier.ClassProperties soldier = cl as PhxSoldier.ClassProperties; if (soldier != null) { foreach (Dictionary <string, IPhxPropRef> section in soldier.Weapons) { if (section.TryGetValue("WeaponName", out IPhxPropRef nameVal)) { PhxProp <string> weapName = (PhxProp <string>)nameVal; PhxClass weapClass = RTS.GetClass(weapName); if (weapClass != null) { PhxProp <int> medalProp = weapClass.P.Get <PhxProp <int> >("MedalsTypeToUnlock"); if (medalProp != null && medalProp != 0) { // Skip medal/award weapons for display continue; } detailText += weapClass.LocalizedName + '\n'; } } } item.SetDetailText(detailText); } Items.Add(item); if (CurrentSelection == null) { SetActive(item, cl, preview); } else { item.SetActive(false); preview.GetInstance().gameObject.SetActive(false); } ReCalcItemSize(); }
public void Free() { Mode = CamMode.Free; FollowInstance = null; }
public void Fixed() { Mode = CamMode.Fixed; FollowInstance = null; }
public void Follow(IPhxControlableInstance follow) { Mode = CamMode.Follow; FollowInstance = follow; }