Ejemplo n.º 1
0
 public void Awake()
 {
     prush     = this;
     hans      = (Transform)GameObject.FindGameObjectWithTag("Player").transform;
     hansCNS   = hans.GetComponent <CentralNervousSystem> ();
     hansBrain = hans.GetComponent <HumanInput> ();
     prushPlatform.gameObject.SetActive(false);
 }
Ejemplo n.º 2
0
        public async Task <Human> CreateHumanAsync(HumanInput humanInput, CancellationToken cancellationToken)
        {
            var human = this.humanInputToHumanMapper.Map(humanInput);

            human = await this.humanRepository
                    .AddHumanAsync(human, cancellationToken)
                    .ConfigureAwait(false);

            await this.topicEventSender
            .SendAsync(nameof(SubscriptionResolver.OnHumanCreatedAsync), human.Id, CancellationToken.None)
            .ConfigureAwait(false);

            return(human);
        }
Ejemplo n.º 3
0
        public async Task <Human> CreateHumanAsync(
            [Service] IImmutableMapper <HumanInput, Human> humanInputToHumanMapper,
            [Service] IHumanRepository humanRepository,
            HumanInput humanInput,
            CancellationToken cancellationToken)
        {
            var human = humanInputToHumanMapper.Map(humanInput);

            human = await humanRepository
                    .AddHumanAsync(human, cancellationToken)
                    .ConfigureAwait(false);

            return(human);
        }
Ejemplo n.º 4
0
 /**
  * Static constructor.
  */
 public static void InitGeneralUtils()
 {
     BallUtils.InitBallUtilities();
     NetUtils.InitNetUtils();
     m_mainScript            = GameObject.Find("ScriptHub").GetComponent <Main>();
     m_agentScript           = GameObject.Find("Agent").GetComponent <AgentInput>();
     m_humanScript           = GameObject.Find("P1").GetComponent <HumanInput>();
     m_sessionScript         = GameObject.Find("ScriptHub").GetComponent <SessionBehavior>();
     m_menuScript            = GameObject.Find("ScriptHub").GetComponent <MenuBehavior>();
     m_ballScript            = GameObject.Find("Ball").GetComponent <BallBehavior>();
     m_dataScript            = GameObject.Find("ScriptHub").GetComponent <DataManger>();
     ROLE_SERVER             = 0;
     ROLE_CLIENT             = 1;
     HUMAN_ID                = 0;
     HUMAN_LEFT              = 2;
     HUMAN_RIGHT             = 3;
     AGENT_ID                = 1;
     AGENT_SKILL_RANDOM      = 0;
     AGENT_SKILL_NORMAL      = 1;
     AGENT_SKILL_FAST        = 2;
     RALLY_ID                = 2;
     UNASSIGNED              = 10;
     INPUT_KEYBOARD          = 0;
     INPUT_MOUSE             = 1;
     INPUT_HYDRA             = 2;
     BALL_RADIUS_LARGE       = 2;
     BALL_RADIUS_MEDIUM      = 1;
     BALL_RADIUS_SMALL       = 0.5F;
     PADDLE_SIZE_LARGE       = 9.0757605F;   //150%
     PADDLE_SIZE_MEDIUM      = 6.050507F;    //100%
     PADDLE_SIZE_SMALL       = 4.53788025F;  //75%
     PADDLE_WIDTH_MEDIUM     = 7.41716F;
     RASyN_IP                = "127.0.0.1";
     RASyN_PORT_MAP          = new Dictionary <string, int> ();
     PONG_SERVER_ID          = "PongServer";
     PONG_CLIENT1_ID         = "PongClient1";
     PONG_CLIENT2_ID         = "PongClient2";
     ASSIGNED_PONG_CLIENT_ID = "NULL";
     RASyN_PORT_MAP.Add(PONG_SERVER_ID, 19000);
     RASyN_PORT_MAP.Add(PONG_CLIENT1_ID, 19011);
     RASyN_PORT_MAP.Add(PONG_CLIENT2_ID, 19012);
     jss = new JsonSerializerSettings();
     jss.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
     jss.MissingMemberHandling = MissingMemberHandling.Ignore;
     //jss.PreserveReferencesHandling = PreserveReferencesHandling.Objects;
     DRAW_TIMEOUT = 1000 * 60;         //60 second timeout in milliseconds
     BallUtils.InitBallUtilities();
     NetUtils.InitNetUtils();
     rallyCfg = new RallyConfiguration(Application.dataPath + "/Config/RallyConfiguration.json");
 }
Ejemplo n.º 5
0
 public void Awake()
 {
     humanInput = this;
     cns        = gameObject.GetComponent <CentralNervousSystem> ();
 }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     m_HumanInput = new HumanInput();
 }
 public HumanAgentController(GameObject obj)
 {
     humanInput = obj.AddComponent <HumanInput>();
 }