// Use this for initialization void Start() { // 8 is CustomLight, because CustomLight collision is used to probe lighting. Physics.IgnoreLayerCollision(0, 8); // 9 is Power. Physics.IgnoreLayerCollision(0, 9); Camera.main.cullingMask = Camera.main.cullingMask - (1 << 7); root = gameObject; atlas = Resources.Load <SpriteAtlas>("sprites/atlas"); var instance = BuildingManager.instance; var cam = Camera.main; cam.gameObject.AddComponent <CameraController>(); square = GameObject.CreatePrimitive(PrimitiveType.Quad); square.transform.position = new Vector3(0, 0, 0); g = Ground.Create(); //ga = GenericAgent.Create(new Vector3(5, 1, 5)); o = Obstacle.Create(new Vector3(3, 0, 3)); o.AddComponent <SmoothLightProbe>(); Obstacle.Create(new Vector3(2, 0, 2)); slm = SmoothLightingManager.Create(); var baseGo = new GameObject("Base"); baseGo.transform.position = new Vector3(0, Layers.Environment, 0); BuildingManager.instance.baseBuilding = baseGo.AddComponent <BaseBuilding>(); var relayGo = new GameObject("Relay"); relayGo.transform.position = new Vector3(-3, Layers.Environment, 0); relayGo.AddComponent <RelayBuilding>(); VisualLightIndicator.Create(new Vector3(7, 0.2f, 7)); var lightGo = new GameObject("Light"); lightGo.transform.position = new Vector3(7, Layers.Environment, -7); lightGo.AddComponent <LightBuilding>(); var turretGo = new GameObject("Turret"); turretGo.transform.position = new Vector3(3, Layers.Environment, 0); turretGo.AddComponent <LaserTurretBuilding>(); }
//A. this is registering the services //meaning all I is resolved //Q. can we pass params to services? //B. //the initialization issue, this should be after injection, means after awake private async UniTask Initialize(ActiveRoomState activeRoomState) { // Controller.I.OnAppPause += DestroyModuleGroup; var containerRoot = new GameObject("Room").transform; new RoomReferences(); RoomReferences.I.Canvas = (await Addressables.InstantiateAsync("canvas", containerRoot)) .GetComponent <Transform>(); RoomReferences.I.Root = containerRoot; PrizeView.Create(); await ChatSystem.Create(); await Ground.Create(); new CoreGameplay(); new RoomUserView.Manager(); //dependent on RoomSettings //this will make registering requires order, so no circular dependencies possible RoomUserView.Manager.I.Init(); await CoreGameplay.I.CreatePlayers(); Repository.I.PersonalFullInfo.Money -= RoomSettings.I.BetMoneyToPay(); Background.I.SetForRoom(RoomSettings.I.UserInfos); // AssignRpcs(); if (activeRoomState == null) { Controller.I.SendAsync("Ready").Forget(e => throw e); } else { //todo why this // await UniTask.DelayFrame(1); CoreGameplay.I.ResumeGame(activeRoomState.MyHand, activeRoomState.Ground, activeRoomState.HandCounts, activeRoomState.CurrentTurn); } }
public IEnumerator AutoThrow() => UniTask.ToCoroutine(async() => { await LoadEss(); RoomReferences.I = new RoomReferences { Canvas = canvas, Root = new GameObject().transform }; RoomSettings.I = new RoomSettings(0, 0, fullUserInfos.ToList(), 0); new RoomUserView.Manager(); RoomUserView.Manager.I.Init(); Controller.I = new Mock <IController>().Object; CoreGameplay.I = new Mock <ICoreGameplay>().Object; await Ground.Create(); var oppo = await PlayerBase.Create(0, 1, 0) as IOppo; await oppo.Distribute(); Ground.I.Distribute(new List <int> { 1, 2, 3, 4 }); oppo.Throw(new ThrowResult { ThrownCard = 5, EatenCardsIds = new List <int>() }); await UniTask.Delay(2000); oppo.Throw(new ThrowResult { ThrownCard = 5, EatenCardsIds = new List <int>() }); await UniTask.Delay(2000); oppo.Throw(new ThrowResult { ThrownCard = 5, EatenCardsIds = new List <int>() }); await UniTask.Delay(2000); oppo.Throw(new ThrowResult { ThrownCard = 5, EatenCardsIds = new List <int>() }); await UniTask.Delay(2000); });