public void Initialize(BS_Combatant cmbt, MT_Team t) { _team = t; _pawn = null; _base = cmbt; IsOut = false; }
void OnSelectionSet(SM_SelectionChangedEvent ev) { SM_Pawn pawn = ev.Get <SM_Pawn>(); if (pawn != null) { BS_Combatant comb = pawn.GameParent as BS_Combatant; if (comb != null) { SetCombatant(comb); } } }
public void OnSelectionChanged(SM_SelectionChangedEvent ev) { MT_Combatant comb = null; SM_Pawn pawn = ev.Get <SM_Pawn>(); if (pawn != null) { comb = pawn.GameParent as MT_Combatant; if (comb.Team.Team.IsAI) // TODO: change this to compare against current UI player { comb = null; } } SetCombatant(comb); }
protected bool CheckParentsForPawn(Transform trans, ref SM_Pawn select) { SM_Pawn sel = trans.gameObject.GetComponent <SM_Pawn>(); if (sel != null /* && CanSelect(sel) */) //### TODO add team logic { select = sel; return(true); } for (int i = 0; i < trans.childCount; i++) { Transform newT = trans.GetChild(i); if (CheckParentsForPawn(newT, ref select)) { return(true); } } return(false); }
// --------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------- public void PlaceInArena(MT_ArenaSpawnPoint sp, Transform attachPt) { GameObject go = GM_Game.Resources.InstantiateFromResource(Base.VisualPrefabName, attachPt, sp.transform.position, sp.transform.rotation); Dbg.Assert(go != null, "ERROR: Failed to instantiate from resource: " + Base.VisualPrefabName); _pawn = go.GetComponent <SM_Pawn>(); if (Dbg.Assert(_pawn != null, "DATA ERROR: Loaded prefab has no pawn component attached: " + Base.VisualPrefabName)) { return; } _pawn.SetName(Base.FullName); _pawn.SetGameParent(this); // TO DO remove selection projector connecting in combatant. GameObject proj = GM_Game.Resources.InstantiateFromResource("CharacterModels/SelectionProjector", go.transform, Vector3.zero, Quaternion.identity); proj.transform.localPosition = Vector3.zero; _pawn.SetSelection(proj.GetComponent <SM_SelectableComponent>()); }
void OnSelectionChanged(SM_SelectionChangedEvent ev) { if (Dbg.Assert(ev.NewWho != null)) { return; } MT_Combatant commandable = null; for (int i = 0; commandable == null && i < ev.NewWho.Count; i++) { SM_Pawn t = ev.NewWho[i] as SM_Pawn; if (t != null) { MT_Combatant matchComb = t.GameParent as MT_Combatant; if (matchComb != null) { if (matchComb.Team.Team.IsAI == false) { commandable = matchComb; } } } } if (commandable == _lastCombatant) { return; } _lastCombatant = commandable; ClearAll(); if (commandable != null) { RebuildActionList(commandable); } }
public virtual void SetTarget(SM_Pawn p) { Dbg.Assert(TargetType == Target.Pawn || TargetType == Target.Keyword); }
public void Shutdown() { _base = null; _pawn = null; _team = null; }