退避区
Inheritance: Area
Exemplo n.º 1
0
        private bool ranHeroSelectionAtLeastOnce = false; // Hero selection has code other parts depend on


        public ReplayAnalyzer() : base()
        {
            tickTimer          = new System.Timers.Timer(1000.0 / 30.0);
            tickTimer.Elapsed += new System.Timers.ElapsedEventHandler(tickCallback);

            heroData         = new HeroParser(GUISelection.replayDataFolderLocation);
            heroIDData       = new ReplayHeroID(GUISelection.replayDataFolderLocation);
            replayTick       = new ReplayTick(GUISelection.replayDataFolderLocation);
            replayHighlights = new ReplayHighlights(GUISelection.replayDataFolderLocation, GUISelection.heroName);
            replayHighlights.ConstructTickInfo(replayTick);
            lastHitCalculator = new LastHitCalculator();
            retreat           = new Retreat();

            heroID = heroIDData.getHeroID(GUISelection.heroName);
            string heroname = GUISelection.heroName;

            team_side = 0;
            for (int i = 0; i < table.Length / 4; i++)
            {
                if (table[i, 0] == hero_table[heroname])
                {
                    team_side = table[i, 2];
                }
            }
            suggestiontable = cp.suggestionTable_1(team_side, 3);
            table_checkmark = cp.checkMark();
        }
Exemplo n.º 2
0
 public ActionResult Create(Retreat retreatModel)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     _retreatRepository.Add(retreatModel);
     return(this.RedirectToAction(c => c.Index(retreatModel.Id)));
 }
Exemplo n.º 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     TimingEnd();
     if (Owner is FrmLoanSubmit parent)
     {
         parent.SubmitPostBack = SubmitPostBack;
     }
     Retreat?.Invoke(sender, e);
 }
Exemplo n.º 4
0
 Uri BuildDeleteLink(Retreat retreat, Participant participant)
 {
     // TODO: should have a delete view model here instead?
     return(_urlMapper.MapAction <ParticipantController>(
                x => x.DeleteFromRetreat(
                    retreat.Id,
                    retreat.StartDate,
                    participant.Id,
                    participant.FirstName,
                    participant.LastName)));
 }
Exemplo n.º 5
0
 void Awake()
 {
     over     = false;
     rb       = GetComponent <Rigidbody2D>();
     boosted  = false;
     maxSpeed = 9;
     current  = this;
     sprite   = GetComponent <SpriteRenderer>();
     color    = sprite.color;
     done     = false;
     endRun   = false;
 }
Exemplo n.º 6
0
        static void FillRetreat(Retreat retreat)
        {
            for (int x = 0; x < 29; x++)
            {
                var bed = new Bed {
                    Code = "bedcode" + x
                };
                var participant = new Participant();

                retreat.AddParticipant(participant, bed);
            }
        }
Exemplo n.º 7
0
    private PrioritySelector GoodHealthPattern()
    {
        //PlayAnimation walkAnimation = new PlayAnimation(gameObject, walk);
        Retreat retreat = new Retreat(gameObject, enemy, retreatSpeed);
        //PlayerAround playerAround = new PlayerAround(retreat, gameObject, enemy, playerDistance);
        //Sequence walkAround = new Sequence(new List<Node> { walkAnimation, playerAround });

        ActionNode repeatAttack = Attack(attack2);

        return(new PrioritySelector(new List <Node> {
            repeatAttack, retreat
        }));
    }
Exemplo n.º 8
0
 public User()
 {
     Deck       = new Deck(this);
     Hand       = new Hand(this);
     Retreat    = new Retreat(this);
     Support    = new Support(this);
     Bond       = new Bond(this);
     Orb        = new Orb(this);
     Field      = new Field(this);
     FrontField = new FrontField(this);
     BackField  = new BackField(this);
     Overlay    = new Overlay(this);
     Guid       = System.Guid.NewGuid().ToString();
 }
Exemplo n.º 9
0
 public void AddRetreatLines(StringBuilder sb, Retreat retreat)
 {
     AddReportLine(sb,
                   "Name/ContactInfo",
                   "NOTES",
                   "Special Notes: Alergies/Dietary and Mobility Issues",
                   "Room Assignment");
     foreach (var reg in retreat.Registrations)
     {
         AddReportLine(sb,
                       reg.Participant.FirstName + " " + reg.Participant.LastName,
                       string.Empty,
                       reg.Participant.Notes,
                       reg.Bed.Code);
     }
 }
Exemplo n.º 10
0
    protected override void Execute()
    {
        if (Core is Craft)
        {
            if ((Core is ShellCore shellCore && shellCore.GetCarrier() == null) && !(Core is PlayerCore player && player.havenSpawnPoint != Vector2.zero))
            {
                return;
            }

            AudioManager.PlayClipByID("clip_activateability", transform.position);
            // get all current retreats, set the new retreat's start times to the old retreat start times, find one that is off CD
            // and set it to CD
            List <Retreat> oldRetreats = new List <Retreat>();
            foreach (Ability ability in Core.GetAbilities())
            {
                if (ability && !ability.IsDestroyed() && ability is Retreat retreat)
                {
                    oldRetreats.Add(retreat);
                }
            }

            (Core as Craft).Respawn();

            List <Retreat> newRetreats = new List <Retreat>();
            foreach (Ability ability in Core.GetAbilities())
            {
                if (ability && !ability.IsDestroyed() && ability is Retreat retreat)
                {
                    newRetreats.Add(retreat);
                }
            }

            for (int i = 0; i < oldRetreats.Count; i++)
            {
                newRetreats[i].startTime = oldRetreats[i].startTime;
            }

            // prior to Awake activation since Respawn was set on this stack. We therefore search for 0 here
            Retreat r = newRetreats.Find((a) => { return(a.startTime == 0); });
            if (r != null)
            {
                r.startTime = Time.time - activeDuration + 0.1f;
            }
        }
    }
Exemplo n.º 11
0
 public override void Tick(int key)
 {
     base.Tick(key);
     if (isOnCD && Time.time > activationTime && charging)
     {
         charging = false;
         AudioManager.PlayClipByID("clip_activateability", transform.position);
         if (Core is Craft)
         {
             (Core as Craft).Respawn();
             Retreat r = Core.GetAbilities().First((a) => { return(a is Retreat); }) as Retreat;
             if (r != null)
             {
                 r.isOnCD      = true;
                 r.CDRemaining = r.cooldownDuration - activationDelay;
             }
         }
     }
 }
Exemplo n.º 12
0
        public bool CreateRetreat(RetreatCreate model)
        {
            var entity =
                new Retreat()
            {
                RetreatName   = model.RetreatName,
                RetreatDate   = model.RetreatDate,
                RetreatLength = model.RetreatLength,
                //TeacherId = model.TeacherId,
                CenterId    = model.CenterId,
                Description = model.Description
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Retreats.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }
Exemplo n.º 13
0
        string GenerateReportHtmlForRetreat(Retreat retreat, string seed)
        {
            if (retreat != null)
            {
                seed += string.Format(_reportHtmlRetreatInfo, retreat.StartDate.ToLongDateString(), retreat.Description);

                seed = retreat.Registrations.OrderBy(x => x.Bed == null ? "waitlist" : x.Bed.Code).Aggregate(seed, (memo, r) =>
                {
                    var name    = r.Participant.FirstName + " " + r.Participant.LastName;
                    var notes   = r.Participant.Notes == null ? string.Empty : r.Participant.Notes;
                    var bedCode = r.Bed == null ? "waitlist" : r.Bed.Code;
                    var color   = bedCode.StartsWith("waitlist") ? "gray" :
                                  bedCode.StartsWith("CS") ? "rose" :
                                  bedCode.StartsWith("L") ? "blue" :
                                  bedCode.StartsWith("GH") ? "orange" :
                                  "green";
                    return(memo + string.Format(_reportHtmlRegistrationInfo, name, notes.Replace("\n", "<br />"), color, bedCode));
                });
            }
            return(seed);
        }
Exemplo n.º 14
0
 Uri AddParticipantLinkForRetreat(Retreat retreat)
 {
     return(_urlMapper.MapAction <ParticipantController>(
                x => x.AddToRetreat(retreat.Id)));
 }
Exemplo n.º 15
0
    public override void Init()
    {
        base.Init();
        wanderState     = new WanderState(this);
        hideState       = new HideState(this);
        retreatState    = new Retreat(this, enemyObj.health.maxHealth);
        refillAmmoState = new RefifllAmmo(this);
        stunnedState    = new StunnedState(this);

        hideState.AddTransition(() =>
        {
            if (hideState.doneHiding)
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Ok, done hiding");
                return(true);
            }
            return(false);
        }, wanderState);

        //Will look for healthpack if health is not at max
        wanderState.AddTransition(() =>
        {
            if (enemyObj.health.GetHealth() < enemyObj.health.maxHealth)
            {
                var packs = GameManager.Instance.GetAvailableHealthPacks();
                if (packs.Count > 0)
                {
                    if (stateMachine.GetCurrentState() != retreatState)
                    {
                        retreatState.allPacks = packs.ToArray();

                        Diagnostic.Instance.AddLog(enemyObj.gameObject, "Low health, got nothing to do, going to get some");
                        return(true);
                    }
                }
            }
            return(false);
        }, retreatState);

        //Will look for healthpack if health is not at max
        wanderState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo < enemyObj.rifle.MaxAmmo)
            {
                var packs = GameManager.Instance.GetAvailableAmmoPacks();
                if (packs.Count > 0)
                {
                    if (stateMachine.GetCurrentState() != refillAmmoState)
                    {
                        refillAmmoState.allPacks = packs.ToArray();

                        Diagnostic.Instance.AddLog(enemyObj.gameObject, "Low ammo, got nothing to do, going to get some");
                        return(true);
                    }
                }
            }
            return(false);
        }, refillAmmoState);

        retreatState.AddTransition(() =>
        {
            var packs = GameManager.Instance.GetAvailableHealthPacks();
            //If the health was restored, or no packs available  go back wandering
            if (enemyObj.health.GetHealth() >= enemyObj.health.maxHealth ||
                enemyObj.health.GetHealth() < enemyObj.health.maxHealth && packs.Count == 0)
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Feeling better, going to stroll around...");
                return(true);
            }

            return(false);
        }, wanderState);

        refillAmmoState.AddTransition(() =>
        {
            var packs = GameManager.Instance.GetAvailableAmmoPacks();
            //If the health was restored, or no packs available  go back wandering
            if (enemyObj.rifle.Ammo >= enemyObj.rifle.MaxAmmo ||
                enemyObj.rifle.Ammo < enemyObj.rifle.MaxAmmo && packs.Count == 0)
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Feeling better, going to stroll around...");
                return(true);
            }

            return(false);
        }, wanderState);

        stunnedState.AddTransition(() =>
        {
            if (!stunnedState.isStunned)
            {
                return(true);
            }

            return(false);
        },
                                   hideState);

        stateMachine.SetState(wanderState);
    }
Exemplo n.º 16
0
    public override void Init()
    {
        base.Init();
        wanderState        = new WanderState(this);
        shootState         = new ShootState(this, enemyObj.shootRate);
        investigationState = new InvestigateState(this);
        stunnedState       = new StunnedState(this);
        meleeAttackState   = new MeleeAttackState(this);
        refillAmmoState    = new RefifllAmmo(this);
        retreatState       = new Retreat(this, minHealthForRetreat);

        qMark = Resources.Load <Sprite>("StateIcons\\what");

        wanderState.AddTransition(() =>
        {
            if (enemyObj.enemySight.IsPlayerInSight() && enemyObj.rifle.Ammo > 0)
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "See the player, shooting!");

                return(true);
            }
            return(false);
        }, shootState);

        wanderState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo <= 0)
            {
                var packs = GameManager.Instance.GetAvailableAmmoPacks();
                if (packs.Count > 0)
                {
                    if (stateMachine.GetCurrentState() != refillAmmoState)
                    {
                        refillAmmoState.allPacks = packs.ToArray();
                        Diagnostic.Instance.AddLog(enemyObj.gameObject, "No ammo, got nothing to do, going to get some");
                        return(true);
                    }
                }
            }
            return(false);
        }, refillAmmoState);

        wanderState.AddTransition(() =>
        {
            if (enemyObj.health.GetHealth() < minHealthForRetreat)
            {
                var packs = GameManager.Instance.GetAvailableHealthPacks();
                if (packs.Count > 0)
                {
                    if (stateMachine.GetCurrentState() != retreatState)
                    {
                        retreatState.allPacks = packs.ToArray();

                        Diagnostic.Instance.AddLog(enemyObj.gameObject, "Low health, got nothing to do, going to get some");
                        return(true);
                    }
                }
            }
            return(false);
        }, retreatState);

        wanderState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo <= 0)
            {
                var packs = GameManager.Instance.GetAvailableAmmoPacks();
                if (packs.Count > 0)
                {
                    if (stateMachine.GetCurrentState() != refillAmmoState)
                    {
                        Diagnostic.Instance.AddLog(enemyObj.gameObject, "No ammo, got nothing to do, going to get some");
                        return(true);
                    }
                }
            }
            return(false);
        }, refillAmmoState);

        wanderState.AddTransition(() =>
        {
            if (enemyObj.enemySight.IsPlayerInSight() && enemyObj.rifle.Ammo <= 0)
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "See the player, no ammo, will attack with hands!");

                return(true);
            }
            return(false);
        }, meleeAttackState);

        refillAmmoState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo > 0)
            {
                if (refillAmmoState.playerLastKnowsPosition == null)
                {
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "Go ammo, don't know where player is, will wander around");
                    return(true);
                }
            }

            return(false);
        }, wanderState);

        refillAmmoState.AddTransition(() =>
        {
            if (enemyObj.enemySight.IsPlayerInSight())
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Saw player, no time for refill ammo, attack!");
                return(true);
            }

            return(false);
        }, meleeAttackState);

        retreatState.AddTransition(() =>
        {
            if (enemyObj.enemySight.IsPlayerInSight())
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Saw player, no time for get healthpack, attack!");
                return(true);
            }

            return(false);
        }, shootState);

        retreatState.AddTransition(() =>
        {
            //If the health was restored OR health is low but no packs available, go back wandering
            if (enemyObj.health.GetHealth() > minHealthForRetreat ||
                (enemyObj.health.GetHealth() <= minHealthForRetreat && GameManager.Instance.GetAvailableHealthPacks().Count == 0))
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Feeling better, going to stroll around...");
                return(true);
            }

            return(false);
        }, wanderState);

        shootState.AddTransition(() =>
        {
            if (!enemyObj.enemySight.IsPlayerInSight())
            {
                investigationState.waitBeforeGoingToPoint = 0;
                investigationState.investigationPoint     = Player.Instance.transform.position;
                shootTimer = 15.0f;
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Lost sight of player, going to check last known psition (and keep shooting, why not)");

                return(true);
            }
            return(false);
        }, investigationState);

        shootState.AddTransition(() => {
            return(enemyObj.rifle.Ammo <= 0);
        }, meleeAttackState);

        meleeAttackState.AddTransition(() => {
            if (meleeAttackState.playerLastKnownPosition != null)
            {
                investigationState.investigationPoint = meleeAttackState.playerLastKnownPosition.Value;
                return(true);
            }

            return(false);
        }, investigationState);

        investigationState.AddTransition(() => {
            if (enemyObj.enemySight.IsPlayerInSight())
            {
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "See the player, shooting!");

                return(true);
            }
            return(false);
        }, shootState);

        investigationState.AddTransition(() => {
            return(investigationState.done);
        }, wanderState);

        stunnedState.AddTransition(() =>
        {
            if (!stunnedState.isStunned)
            {
                investigationState.investigationPoint = enemyObj.transform.position;

                return(true);
            }

            return(false);
        },
                                   investigationState);


        //Beserk will respond to alarm
        Enemy.OnAlarmSent += GoInsestigateSOS;
        stateMachine.SetState(wanderState);
    }
Exemplo n.º 17
0
 public void PlayRetreat()
 {
     Retreat.Play();
 }
Exemplo n.º 18
0
 public void Save(Retreat retreat)
 {
     _session.SaveOrUpdate(retreat);
     _session.Flush();
 }
Exemplo n.º 19
0
 void IRetreatRepository.Add(Retreat retreat)
 {
     _session.Save(retreat);
     _session.Flush();
 }
Exemplo n.º 20
0
    public override void Init()
    {
        base.Init();
        wanderState        = new WanderState(this);
        shootState         = new ShootState(this, enemyObj.shootRate);
        investigationState = new InvestigateState(this);
        retreatState       = new Retreat(this, minHealthForRetreat);
        hideState          = new HideState(this);
        bombAvoidState     = new BombAvoid(this);
        refillAmmoState    = new RefifllAmmo(this);
        stunnedState       = new StunnedState(this);

        shootState.AddTransition(() =>
        {
            if (!enemyObj.enemySight.IsPlayerInSight())
            {
                investigationState.waitBeforeGoingToPoint = 0;
                investigationState.investigationPoint     = Player.Instance.transform.position;
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Lost sight of player, going to check last known position");

                return(true);
            }
            return(false);
        }, investigationState);

        shootState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo <= 0)
            {
                var allPacks = GameManager.Instance.GetAvailableAmmoPacks();
                if (allPacks.Count == 0)
                {
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "Out of ammo, no packs around, going to hide!");
                    return(true);
                }
            }
            return(false);
        }, hideState);

        shootState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo <= 0)
            {
                var allPacks = GameManager.Instance.GetAvailableAmmoPacks();
                if (allPacks.Count > 0)
                {
                    refillAmmoState.allPacks = allPacks.ToArray();
                    refillAmmoState.playerLastKnowsPosition = Player.Instance.transform.position;
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "Out of ammo, going to refill!");
                    return(true);
                }
            }
            return(false);
        }, refillAmmoState);

        investigationState.AddTransition(() => {
            return(investigationState.done);
        }, wanderState);

        refillAmmoState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo <= 0)
            {
                var allPacks = GameManager.Instance.GetAvailableAmmoPacks();
                if (allPacks.Count == 0)
                {
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "No ammo boxe available, will hide!");

                    return(true);
                }
            }

            return(false);
        }, hideState);

        refillAmmoState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo > 0)
            {
                if (refillAmmoState.playerLastKnowsPosition != null)
                {
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "Go ammo, going to check last player known position");

                    investigationState.investigationPoint = refillAmmoState.playerLastKnowsPosition.Value;
                    return(true);
                }
            }

            return(false);
        }, investigationState);

        refillAmmoState.AddTransition(() =>
        {
            if (enemyObj.rifle.Ammo > 0)
            {
                if (refillAmmoState.playerLastKnowsPosition == null)
                {
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "Go ammo, don't know where player is, will wander around");

                    return(true);
                }
            }

            return(false);
        }, wanderState);

        //If health is ok and retreat has a player known pos, go investigate
        retreatState.AddTransition(() => {
            if (enemyObj.health.GetHealth() >= minHealthForRetreat)
            {
                if (retreatState.playerLastKnowsPosition != null)
                {
                    investigationState.investigationPoint = retreatState.playerLastKnowsPosition.Value;
                }

                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Feeling better, go to check last investigation point");

                return(true);
            }

            return(false);
        }, investigationState);

        //If health is ok and retreat has no player known pos, go patrol

        retreatState.AddTransition(() => {
            if (enemyObj.health.GetHealth() >= minHealthForRetreat)
            {
                if (retreatState.playerLastKnowsPosition == null)
                {
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "Feeling better, go to back to wander");
                    return(true);
                }
            }

            return(false);
        }, wanderState);

        retreatState.AddTransition(() =>
        {
            if (enemyObj.health.GetHealth() < minHealthForRetreat)
            {
                var packs = GameManager.Instance.GetAvailableHealthPacks();

                if (packs.Count == 0 && !hideState.isHiding)
                {
                    Diagnostic.Instance.AddLog(enemyObj.gameObject, "Go a healthpack, but still feel crap, will go hide");
                }

                return(packs.Count == 0 && !hideState.isHiding);
            }
            return(false);
        }, hideState);


        //Will come out of hiding only when a health pack is available again
        hideState.AddTransition(() => {
            var packs = GameManager.Instance.GetAvailableHealthPacks();

            if (packs.Count > 0 && enemyObj.health.GetHealth() < retreatState.minHealthForRetreat)
            {
                retreatState.allPacks = packs.ToArray();
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Healthpack is available, going to get it!");

                return(true);
            }

            return(false);
        }, retreatState);

        //Will come out of hiding only when a ammo pack is available again
        hideState.AddTransition(() => {
            var packs = GameManager.Instance.GetAvailableAmmoPacks();
            if (packs.Count > 0 && enemyObj.health.GetHealth() >= retreatState.minHealthForRetreat)
            {
                refillAmmoState.allPacks = packs.ToArray();
                Diagnostic.Instance.AddLog(enemyObj.gameObject, "Ammo box is available, going to get it!");

                return(true);
            }

            return(false);
        }, refillAmmoState);

        bombAvoidState.AddTransitionDynamicState(() =>
        {
            return(bombAvoidState.readyToGo);
        },
                                                 () => { return(stateMachine.previousState); });

        stunnedState.AddTransition(() =>
        {
            if (!stunnedState.isStunned)
            {
                investigationState.investigationPoint = enemyObj.transform.position;

                return(true);
            }

            return(false);
        },
                                   investigationState);

        //Soldier will respond to alarm
        Enemy.OnAlarmSent += GoInvestigateSOS;
        stateMachine.SetState(wanderState);
    }