Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            var viewport = graphics.GraphicsDevice.Viewport;

            soccerPitch = new SoccerPitch(viewport.Width, viewport.Height);

            base.Initialize();
        }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this.gameObject);
        }
        DontDestroyOnLoad(this.gameObject);

        entityCount = 0;
    }
Exemplo n.º 3
0
    public SoccerTeam(Goal home_goal, Goal opponents_goal, SoccerPitch pitch, team_color team_color)
    {
        this.homeGoal      = home_goal;
        this.opponentsGoal = opponents_goal;
        this.soccerPitch   = pitch;
        this.teamColor     = team_color;

        this.controllingPlayer   = null;
        this.supportingPlayer    = null;
        this.receivingPlayer     = null;
        this.playerClosestToBall = null;

        this.distSqToBallOfClosestPlayer = 0;

        //setup the state machine for this team
        this.StateMachine = new StateMachine <SoccerTeam>(this);

        //the first state of a team is defending
        this.StateMachine.SetPreviousState(Defending.Instance);
        this.StateMachine.SetCurrentState(Defending.Instance);
        this.StateMachine.SetGlobalState(null);
    }
 public SteeringBehaviors(PlayerBase agent, SoccerPitch pitch, SoccerBall soccerBall)
 {
     this.player = agent;
     this.world  = pitch;
     this.ball   = soccerBall;
 }