//transpiler method investigate
        internal static bool SelectAllFormationsPrefix(ref OrderController __instance, Agent selectorAgent, bool uiFeedback)
        {
            if (GameNetwork.IsClient)
            {
                GameNetwork.BeginModuleEventAsClient();
                GameNetwork.WriteMessage(new SelectAllFormations());
                GameNetwork.EndModuleEventAsClient();
            }
            if (uiFeedback && !GameNetwork.IsClientOrReplay && selectorAgent != null && Mission.Current.IsOrderShoutingAllowed())
            {
                VoiceCommandQueue.QueueItem("Everyone", 800f);
            }

            var _selectedFormations = MissionAccessTools.Get_selectedFormations(ref __instance);

            _selectedFormations.Clear();

            var _team = MissionAccessTools.Get_team(ref __instance);
            IEnumerable <Formation> formations = _team.Formations;

            foreach (Formation formation in _team.Formations.Where <Formation>((Func <Formation, bool>)(f => IsFormationSelectable(f, selectorAgent))))
            {
                _selectedFormations.Add(formation);
            }

            OrderControllerReversePatches.OnSelectedFormationsCollectionChanged(__instance);

            return(false);
        }
        internal static bool SelectFormationMakeVoicePrefix(Formation formation, Agent agent)
        {
            if (!Mission.Current.IsOrderShoutingAllowed())
            {
                return(false);
            }

            float delay = 800f;

            switch (formation.InitialClass)
            {
            case FormationClass.Infantry:
            case FormationClass.HeavyInfantry:
                VoiceCommandQueue.QueueItem("Infantry", delay);
                return(false);

            case FormationClass.Ranged:
            case FormationClass.NumberOfDefaultFormations:
                VoiceCommandQueue.QueueItem("Archers", delay);
                return(false);

            case FormationClass.Cavalry:
            case FormationClass.LightCavalry:
            case FormationClass.HeavyCavalry:
                VoiceCommandQueue.QueueItem("Cavalry", delay);
                return(false);

            case FormationClass.HorseArcher:
                VoiceCommandQueue.QueueItem("HorseArchers", delay + 800f);
                return(false);

            default:
                return(false);
            }
        }
Esempio n. 3
0
        public override void OnMissionTick(float dt)
        {
            var queue = VoiceCommandQueue.GetVoiceCommandQueue();

            if (queue.Count > 0)
            {
                var timer = VoiceCommandQueue.GetVoiceCommandTimer();

                if (timer.IsPast)
                {
                    var queueItem = VoiceCommandQueue.GetNextQueueItem();
                    var voiceType = new SkinVoiceType(queueItem.VoiceTypeString);

                    Agent.Main.MakeVoice(voiceType, CombatVoiceNetworkPredictionType.NoPrediction);
                    VoiceCommandQueue.ResetVoiceCommandTimer(queueItem.DelayAfter);
                }
            }
            base.OnMissionTick(dt);
        }
Esempio n. 4
0
 public QueuedVoiceLogic() : base()
 {
     VoiceCommandQueue.ResetVoiceCommandTimer(10f);
 }
        internal static bool AfterSetOrderMakeVoice(OrderType orderType, Agent agent)
        {
            if (!Mission.Current.IsOrderShoutingAllowed())
            {
                return(false);
            }

            switch (orderType)
            {
            case OrderType.Move:
            case OrderType.MoveToLineSegment:
            case OrderType.MoveToLineSegmentWithHorizontalLayout:
                VoiceCommandQueue.QueueItem("Move", 800f);
                return(false);

            case OrderType.Charge:
            case OrderType.ChargeWithTarget:
                VoiceCommandQueue.QueueItem("Charge", 800f);
                return(false);

            case OrderType.StandYourGround:
                VoiceCommandQueue.QueueItem("Stop", 800f);
                return(false);

            case OrderType.FollowMe:
                VoiceCommandQueue.QueueItem("Follow", 800f);
                return(false);

            case OrderType.FollowEntity:
            case OrderType.GuardMe:
            case OrderType.Attach:
            case OrderType.FormCustom:
            case OrderType.FormDeep:
            case OrderType.FormWide:
            case OrderType.FormWider:
            case OrderType.CohesionHigh:
            case OrderType.CohesionMedium:
            case OrderType.CohesionLow:
            case OrderType.RideFree:
            case OrderType.UseAnyWeapon:
            case OrderType.UseBluntWeaponsOnly:
                break;

            case OrderType.Retreat:
                VoiceCommandQueue.QueueItem("Retreat", 1200f);
                return(false);

            case OrderType.AdvanceTenPaces:
            case OrderType.Advance:
                VoiceCommandQueue.QueueItem("Advance", 1200f);
                return(false);

            case OrderType.FallBackTenPaces:
            case OrderType.FallBack:
                VoiceCommandQueue.QueueItem("FallBack", 1200f);
                return(false);

            case OrderType.LookAtEnemy:
                VoiceCommandQueue.QueueItem("FaceEnemy", 1200f);
                return(false);

            case OrderType.LookAtDirection:
                VoiceCommandQueue.QueueItem("FaceDirection", 1200f);
                break;

            case OrderType.ArrangementLine:
                VoiceCommandQueue.QueueItem("FormLine", 1200f);
                return(false);

            case OrderType.ArrangementCloseOrder:
                VoiceCommandQueue.QueueItem("FormShieldWall", 1700f);
                return(false);

            case OrderType.ArrangementLoose:
                VoiceCommandQueue.QueueItem("FormLoose", 1200f);
                return(false);

            case OrderType.ArrangementCircular:
                VoiceCommandQueue.QueueItem("FormCircle", 1200f);
                return(false);

            case OrderType.ArrangementSchiltron:
                VoiceCommandQueue.QueueItem("FormSquare", 1200f);
                return(false);

            case OrderType.ArrangementVee:
                VoiceCommandQueue.QueueItem("FormSkein", 1200f);
                return(false);

            case OrderType.ArrangementColumn:
                VoiceCommandQueue.QueueItem("FormColumn", 1200f);
                return(false);

            case OrderType.ArrangementScatter:
                VoiceCommandQueue.QueueItem("FormScatter", 1200f);
                return(false);

            case OrderType.HoldFire:
                VoiceCommandQueue.QueueItem("HoldFire", 1200f);
                return(false);

            case OrderType.FireAtWill:
                VoiceCommandQueue.QueueItem("FireAtWill", 1200f);
                return(false);

            case OrderType.Mount:
                VoiceCommandQueue.QueueItem("Mount", 1200f);
                return(false);

            case OrderType.Dismount:
                VoiceCommandQueue.QueueItem("Dismount", 1200f);
                return(false);

            case OrderType.AIControlOn:
                VoiceCommandQueue.QueueItem("CommandDelegate", 1200f);
                return(false);

            case OrderType.AIControlOff:
                VoiceCommandQueue.QueueItem("CommandUndelegate", 1200f);
                return(false);

            default:
                return(false);
            }

            return(false);
        }