public void CheckHitAndGetPoint() { TargetSymbol hitsym = appearSymbols.Find(sym => { return(sym.IsHit(Camera.main.transform.position)); }); if (hitsym != null) { DeleteSymbol(hitsym); ClearTime(); Dictionary <string, object> messageParams = new Dictionary <string, object>(); messageParams.Add("action", "contact"); messageParams.Add("user_id", myUser.user_id); messageParams.Add("room_id", myUser.room_id); string json = JsonConvert.SerializeObject(messageParams); WebSocketManager.Instance.Send(json); // RandomAppearObject(); if (OnHit != null) { OnHit(); } } }
public void DeleteSymbol(TargetSymbol hitsym) { #if UNITY_ANDROID || UNITY_EDITOR Destroy(hitsym.transform.parent.gameObject); #else Destroy(hitsym.gameObject); #endif appearSymbols.Remove(hitsym); }
void InitializeVariables() { //finding all mount points mountPoints = GetComponentsInChildren <MountPoint>(); //initializing size of laser storage lasers = new MiningLaser[mountPoints.Length]; movementController = GetComponent <MovementController>(); //finding UI elements cooldownPanel = GameObject.Find("CooldownPanel"); buttonWidth = cooldownPanel.transform.parent.GetComponent <RectTransform>().rect.width; targetSymbol = FindObjectOfType <TargetSymbol>(); targetSymbol.gameObject.SetActive(false); }