Beispiel #1
0
        }                                                             // base combatants only carried over from match

        // ---------------------------------------------------------------------------------------
        /// <summary>
        /// Create pawns for each combatant and place them in the world
        /// </summary>
        public void PlaceCombatants(MT_Arena arena)
        // ---------------------------------------------------------------------------------------
        {
            for (int i = 0; i < Combatants.Count; i++)
            {
                MT_ArenaSpawnPoint sp = arena.GetUnusedSpawnPoint(TeamNdx);
                if (sp == null)
                {
                    Dbg.LogError("Not enough spawn points for match! failure abounds!");
                    return;
                }
                sp.Used = true;

                Combatants[i].PlaceInArena(sp, arena.PawnRoot.transform);
            }
        }
Beispiel #2
0
        // ---------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------
        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>());
        }