public UIPlayer(GameTable gameTable, MonoPlayer player) : base(gameTable) { unityPlayer = player; biddingPopup = GameObject.FindGameObjectWithTag("MENUS").transform.FindChild("BiddingPopup").GetComponent <BiddingPopup>(); uiDeck = GameObject.FindGameObjectWithTag("DECK").GetComponent <UIDeck>(); }
public void SetupView(MonoPlayer player) { _owner = player; RefreshView(); _owner.disableControlCount.Add(CTRL_KEY); closeBtn.BindViewCallback(Close); }
public void SetupView(MonoPlayer player) { _owner = player; _emitter = GetComponent <StudioEventEmitter>(); RefreshView(); _owner.disableControlCount.Add(CTRL_KEY); closeBtn.BindViewCallback(Close); }
void _OnGameInit(GameInitEvent evt) { mainCamera = GameObject.Find("Main Camera").GetComponent <MonoMainCamera>(); player = Instantiate(playerPrefab); playerCtl = player.GetComponent <MonoPlayer>(); InputUtil.Init(); mainCamera.target = player.transform; EventBus.Post(new CameraPositionResetEvent()); }
private void UpdateMesh(float radius, float angleDegree, int segments) { float angle = Mathf.Deg2Rad * angleDegree; float startAngle = Mathf.Deg2Rad * (180 - angleDegree) / 2f; float angleCurrent = startAngle + angle; float angleDelta = angle / segments; Mesh mesh = transform.GetComponent <MeshFilter>().mesh; Vector3[] vertices = mesh.vertices; for (int i = 1; i < vertices.Length; ++i) { RaycastHit hitInfo; Vector3 direction = transform.TransformPoint(vertices[i]) - transform.position; float length = radius; LayerMask blockMask = 1 << 8 | 1 << 9 | 1 << 10; if (Physics.Raycast(transform.position, direction.normalized, out hitInfo, length, blockMask)) { Vector3 hitPos = transform.InverseTransformPoint(hitInfo.point); vertices[i] = hitPos; //float ratio = (hitPos - transform.position).magnitude / radius; MonoPlayer player = hitInfo.transform.GetComponent <MonoPlayer>(); if (player != null) { //update the state to attack MonoAIManager.Instance.OnDetectEnemy(); } MonoAI ai = hitInfo.transform.GetComponent <MonoAI>(); if (ai != null && ai.status == AIStatus.Freeze) { //update the state to attack MonoAIManager.Instance.OnDetectEnemy(); } } else { Vector3 hitPos = transform.InverseTransformPoint(transform.position + direction.normalized * length); vertices[i] = hitPos; //float ratio = (hitPos - transform.position).magnitude / radius; } angleCurrent -= angleDelta; } mesh.vertices = vertices; mesh.RecalculateNormals(); return; }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("SCRIPTWRAPPER").GetComponent <MonoPlayer>(); menuPosition = new Rect(Screen.width / 20, Screen.height / 20, Screen.width - Screen.width / 10, Screen.height / 2); mainGroupPosition = new Rect(0, 0, menuPosition.width, menuPosition.height); innerGroupPosition = new Rect(menuPosition.width / 10, menuPosition.height / 30, menuPosition.width - menuPosition.width / 5, (menuPosition.height - menuPosition.height / 10)); biddingsPos = new Rect(0, 0, innerGroupPosition.width / 2, innerGroupPosition.height / 2); biddingsPos2 = new Rect(innerGroupPosition.width / 2, 0, innerGroupPosition.width / 2, innerGroupPosition.height / 2); dealTitlePosition = new Rect(-innerGroupPosition.width / 11, -innerGroupPosition.height / 6, innerGroupPosition.width / 7 * 10, innerGroupPosition.height); buttonWidth = innerGroupPosition.width / 8; marginWidth = (innerGroupPosition.width - buttonWidth * 6) / 5; marginWidth2 = (innerGroupPosition.width - buttonWidth * 6) / 4; marginHeight = (innerGroupPosition.height / 3 * 2 - buttonWidth * 4) / 3 + buttonWidth; transformInstance = transform; SetActive(false); }
public void Release() { GameObject scriptWrapper = GameObject.FindGameObjectWithTag("SCRIPTWRAPPER"); if (scriptWrapper != null && !released) { released = true; MonoPlayer player = scriptWrapper.GetComponent <MonoPlayer>(); MonoNetworkPlayer networkPlayer = scriptWrapper.GetComponent <MonoNetworkPlayer>(); if (transform.position.y > player.splitter.transform.position.y) { // CARD PLAYED this.transform.position = new Vector3(transform.position.x, transform.position.y, 1f); player.playerDeck.playedCard = this; PlayedCardsController.PlaceCard(transform); UserInteraction.InputActive = false; // FINALLY ACTUALLY PLAY THE CARD if (Properties.ActiveGameType == GameType.SinglePlayer) { player.getInternalPlayer().PlayCard(this.card); } else { networkPlayer.GetInternalPlayer().PlayCard(this.card); } released = false; } else { ResetPosition(false); } } }
private void Awake() { Instance = this; return; }
public PlayerHungerModule(MonoPlayer owner) { _owner = owner; }