Пример #1
0
        private static bool IsPlayerPersonCanIntent(
            [NotNull] IHumanActorTaskSource <ISectorTaskSourceContext> humanTaskSource,
            [CanBeNull] ISurvivalModule survivalModule)
        {
            if (humanTaskSource is null)
            {
                throw new ArgumentNullException(nameof(humanTaskSource));
            }

            return(!humanTaskSource.CanIntent() && survivalModule?.IsDead == false);
        }
        public bool CanIntent()
        {
            switch (CurrentControl)
            {
            case ActorTaskSourceControl.Human:
                return(_humanActorTaskSource.CanIntent());

            case ActorTaskSourceControl.Bot:
                throw new ActorTaskSourceException("Intension available only under human control.");

            case ActorTaskSourceControl.Undefined:
                throw new ActorTaskSourceException("Task source is undefined.");

            default:
                throw new ActorTaskSourceException($"Task source {CurrentControl} is unknown.");
            }
        }