Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        camera.SetActive(false);
        if (isLocalPlayer)
        {
            camera.SetActive(true);
        }
        transform.position = spawnTransform.Instance.transform.position;
        transform.rotation = spawnTransform.Instance.transform.rotation;
        if (isLocalPlayer)
        {
            try
            {
                canvas = transform.Find("canvas").gameObject;
                //canvasText = canvas.transform.FindChild("tutorial").GetComponent<Text>();
                canvas.active = true;
            }
            catch
            {
                Debug.LogError("Agent don't seems to have a canvas with the name canvas, that the name is canvas is crucial!");
            }
        }

        if (instance == null)
        {
            instance = this;
        }
    }
Esempio n. 2
0
        public static GameObject[] Locate(string id, bool firstcall = true)
        {
            List <GameObject> results = new List <GameObject>();

            results.AddRange(GetPlayer.Locate(id, firstcall));
            results.AddRange(GetRoom.Locate(id, firstcall));

            return(results.ToArray());
        }
Esempio n. 3
0
        public static T[] LocateObjectsWithType <T>(string id, bool firstcall = true) where T : class
        {
            List <T> results = new List <T>();

            results.AddRange(GetPlayer.LocateObjectsWithType <T>(id, firstcall));
            results.AddRange(GetRoom.LocateObjectsWithType <T>(id, firstcall));

            return(results.ToArray());
        }
Esempio n. 4
0
        // Get Player by Id
        public GetPlayerResponse Get(GetPlayer request)
        {
            var player = Db.LoadSingleById<Player>(request.Id);

            if (player == null)
                throw new HttpError(HttpStatusCode.NotFound, new ArgumentException("PlayerId {0} does not exist. ".Fmt(request.Id)));

            // Sort the referenced stats by year.
            player.PlayerTotals.Sort((x, y) => y.Year.CompareTo(x.Year));

            return new GetPlayerResponse { Player = player };
        }
Esempio n. 5
0
        public static GameObject LocateWithGameID(int gameID)
        {
            var found = GetPlayer.LocateWithGameID(gameID);

            if (found != null)
            {
                return(found);
            }
            found = GetRoom.LocateWithGameID(gameID);
            if (found != null)
            {
                return(found);
            }
            return(null);
        }
Esempio n. 6
0
        public void Should_find_player_by_id()
        {
            var user = new UserBuilder().With(u => u.Id, "guid").BuildAndSave();
            var npc  = new NPCBuilder().With(n => n.Id, 7).BuildAndSave();
            var form = new FormSourceBuilder().With(n => n.Id, 101).BuildAndSave();

            new PlayerBuilder()
            .With(p => p.Id, 23)
            .With(p => p.User, user)
            .With(p => p.NPC, npc)
            .With(p => p.FormSource, form)
            .BuildAndSave();

            var cmd = new GetPlayer {
                PlayerId = 23
            };

            var foundPlayer = DomainRegistry.Repository.FindSingle(cmd);

            Assert.That(foundPlayer.Id, Is.EqualTo(23));
            Assert.That(foundPlayer.NPC.Id, Is.EqualTo(7));
            Assert.That(foundPlayer.FormSource.Id, Is.EqualTo(101));
        }
Esempio n. 7
0
 // Start is called before the first frame update
 void Start()
 {
     //GetPlayerから参加人数を取得(仮)
     GetPlayer       = GameObject.Find("SurvivalModeManager");
     GetPlayerScript = GetPlayer.GetComponent <GetPlayer>();
 }
Esempio n. 8
0
 void Awake()
 {
     instance = this;
 }
 public Player Get(GetPlayer request)
 {
     return Repository.GetPlayers().Single(p => p.Id == request.Id);
 }