示例#1
0
        public static void Init()
        {
            states = new Dictionary <TeamStateType, TeamState>();
            states.Add(TeamStateType.Occupy, new Occupy()); // TODO: used only at start. interchangable with Defense
            states.Add(TeamStateType.Attack, new Attack());
            states.Add(TeamStateType.Defense, new Defense());
            states.Add(TeamStateType.SafeNet, new SafeNet());

            CurrentState = TeamStateType.Occupy;
        }
示例#2
0
        public static void Play()
        {
            var me       = Current.World.GetMyPlayer();
            var opponent = Current.World.GetOpponentPlayer();

            if (PlayerHelper.IsFreezeTime())
            {
                Current.Stratagy.State = TeamStateType.Occupy;
                Current.SaferCount     = 0;
            }

            if (Current.Stratagy.State == TeamStateType.SafeNet)
            {
                CurrentState = TeamStateType.SafeNet;

                if (Current.World.Puck.OwnerHockeyistId == Current.Hockeyist.Id)
                {
                    Current.Stratagy.State = CurrentState = TeamStateType.Attack;
                    Current.SaferCount--;
                }
            }
            else
            {
                if (Current.World.Puck.OwnerPlayerId == me.Id)
                {
                    CurrentState = TeamStateType.Attack;
                }
                else
                {
                    CurrentState = TeamStateType.Occupy;
                }

                if (Current.World.Puck.OwnerPlayerId == opponent.Id)
                {
                    CurrentState = TeamStateType.Defense;
                }
            }

            states[CurrentState].Start.Decide();
        }