void Awake() { cam = Camera.main; player = GameObject.FindWithTag("Player").transform; uiManager = GetComponent <UIManager>(); clickManager = GetComponent <ClickManager>(); playerMovement = GetComponent <PlayerMovement>(); dialogueManager = GetComponent <DialogueManager>(); questManager = GetComponent <QuestManager>(); tilemapManager = GetComponent <TilemapManager>(); //Loading stats if (SaveManager.Load <PlayerStats>() != null && !doesStartFresh) { stats = SaveManager.Load <PlayerStats>(); } else { stats = new PlayerStats(); SaveManager.Save(stats); } //Load Inventory //inv = new Inventory(); inv = new Inventory(); debug = stats; }
// "Close Button" event public void CloseAd() { ClickManager.AddCloseClick(); AngryMeter.AddScore(); AdsManager.numberOfAds--; Destroy(gameObject); }
void Awake() { if(_instance != null) throw new Exception("MouseManager is a singleton"); _instance = this; }
public static Vector3 GetUnderPoint(GameEntity ent) { var objPos = ent.transform.position; var rend = ent.GetComponent <Collider2D>(); return(ClickManager.GetPosForChooser(objPos, rend.bounds.size, ent.transform.localScale)); }
public static void SetupPrevBar(GameEntity ent, Map.MapTypes type) { if (TpDict.ContainsKey(ent)) { return; } var bar = staticPrevBar.GetComponent <RectTransform>(); var objPos = ent.Current3Dpos; var rend = ent.GetComponent <SpriteRenderer>(); var posR = ClickManager.GetPosForChooser(objPos, rend.size, new Vector3()); var prevBar = Instantiate(bar.gameObject, objPos, bar.rotation); prevBar.transform.SetParent(ent.transform); prevBar.transform.position = new Vector3(objPos.x, posR.y + bar.rect.height, -3); var button = prevBar.transform.GetChild(0).GetComponent <Button>(); var prevChunk = ChunkConnecter.GetFromConnection(type, ent.ChunkNumber); button.onClick.AddListener(delegate { ChunkManager.ChangeChunkTo(prevChunk); }); TpDict.Add(ent, prevBar); }
void Awake() { if (Ref == null) { Ref = GetComponent <ClickManager>(); } }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { instance = this; GameCenterManager.OnAuthFinished += OnAuthFinished; GameCenterManager.init (); b = gameObject.AddComponent<ConnectionButton> (); b.enabled = false; d = gameObject.AddComponent<DisconnectButton> (); d.enabled = false; m = gameObject.GetComponent<ClickManager> (); m.enabled = false; GameCenterMultiplayer.instance.addEventListener (GameCenterMultiplayer.PLAYER_DISCONNECTED, OnGCPlayerDisconnected); GameCenterMultiplayer.OnMatchStarted += OnGCMatchStart; }
public SelectionManager(SelectionPane selectionPane, PlayerData localPlayer) { _localPlayer = localPlayer; _selectionPane = selectionPane; _selection = new List <PlatoonBehaviour>(); _clickManager = new ClickManager( 0, StartBoxSelection, OnSelectShortClick, EndDrag, UpdateBoxSelection); if (_texture == null) { float areaTransparency = .95f; float borderTransparency = .75f; _texture = new Texture2D(1, 1); _texture.wrapMode = TextureWrapMode.Repeat; _texture.SetPixel( 0, 0, _selectionBoxColor - areaTransparency * Color.black); _texture.Apply(); _borderTexture = new Texture2D(1, 1); _borderTexture.wrapMode = TextureWrapMode.Repeat; _borderTexture.SetPixel( 0, 0, _selectionBoxColor - borderTransparency * Color.black); _borderTexture.Apply(); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); levelManager = GetComponent <LevelManager> (); boardManager = GetComponent <BoardManager> (); clickManager = GetComponent <ClickManager> (); gopherManager = GetComponent <GopherManager> (); catManager = GetComponent <CatManager> (); dogManager = GetComponent <DogManager> (); dogCatcherManager = GetComponent <DogCatcherManager> (); policeManager = GetComponent <PoliceManager> (); bloodHoundManager = GetComponent <BloodhoundManager> (); militaryManager = GetComponent <MilitaryManager> (); enemyMilitaryManager = GetComponent <EnemyMilitaryManager> (); audioManager = GetComponent <AudioSource> (); managers.Add(gopherManager); managers.Add(catManager); managers.Add(dogManager); managers.Add(dogCatcherManager); managers.Add(policeManager); managers.Add(bloodHoundManager); managers.Add(militaryManager); managers.Add(enemyMilitaryManager); Screen.SetResolution(800, 800, false); }
public ClickManagerWindow() { InitializeComponent(); _clickManagerCopy = ClickManager.GetCopyClickManager(); UpdateActions(); }
public override void KillSelf() { if (Destroyed) { return; } if (SecondaryGroundLvL.isSecondaryGroup(Group)) { SecondaryGroundLvL.RemovePos(ChunkNumber, CurrentPos); } else { var chunk = ChunkManager.GetChunkByNum(ChunkNumber); chunk.SetIndex(CurrentPos, -1); chunk.RemoveObject(CurrentPos); } ProgressUnitBar.RemoveProgressBar(this); if (gameObject != null) { ClickManager.RemoveChosing(gameObject); Destroy(gameObject); } Destroyed = true; }
void Awake() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { clickManager = GameObject.Find("UI Root").GetComponent <ClickManager>(); submenuTitle = GameObject.Find("Sub Menu Title"); submenuScrollview = GameObject.Find("Sub Menu Scroll View"); ReloadSubmenu(0); }
private void Awake() { if (Instance == null) { Instance = this; } }
public void ShowUntilMouseup(string textUntilMouseup) { var textAfterMouseUp = mMesh.text; mMesh.text = textUntilMouseup; ClickManager.addMouseUpEvent(() => { mMesh.text = textAfterMouseUp; }); }
// Update is called once per frame void Update() { // If Escape is clicked, free the mouse. if (Input.GetKeyDown(KeyCode.Escape)) { Cursor.lockState = CursorLockMode.None; } Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { Debug.Log("The selected object is: " + hit.collider.name); // Check if the other object has a onClick manager. if (Input.GetMouseButtonDown(0)) { ClickManager cm = hit.collider.gameObject.GetComponent<ClickManager>(); if (cm != null) { cm.functionToCall.Invoke(); } if (hit.transform.name == "Player") { Cursor.lockState = CursorLockMode.Locked; } } } }
public static ClickManager Instance() { if (instance == null) { instance = new GameObject("[Click Manager]").AddComponent <ClickManager>(); } return(instance); }
private void OnSelectState() { //On left click if (Input.GetMouseButtonDown(0)) { //Higlighting of hitobjects Fruit hitObject = DetectHitObject(); if (hitObject != null) { //Select slider if (!ClickManager.DoubleClick() && hitObject.transform.parent.GetComponent <Slider>()) { Slider slider = hitObject.transform.parent.GetComponent <Slider>(); selectedHitObject = slider; //When the dragging starts if (draggingHitObject == null) { distanceFromSliderFruit = slider.transform.position - Input.mousePosition; } draggingHitObject = slider; slider.OnHightlight(); } else //Select fruit { //Unhighlight previously selected selectedHitObject?.UnHighlight(); selectedHitObject = hitObject; draggingHitObject = hitObject; hitObject.OnHightlight(); } } } if (Input.GetKeyDown(KeyCode.Delete)) { Destroy(selectedHitObject.gameObject); selectedHitObject = null; draggingHitObject = null; } //Reset dragging if mouse button is released if (Input.GetMouseButtonUp(0)) { selectedHitObject?.UnHighlight(); draggingHitObject = null; selectedHitObject = null; } if (draggingHitObject == null) { return; } DraggingBehaviour(); }
void Awake() { if (instance != null) { print("More than one instance of ClickManager found"); return; } instance = this; }
protected void Init() { cm = GameObject.Find("ClickManager").GetComponent <ClickManager>(); tiles = GameObject.FindGameObjectsWithTag("Tile"); foreach (GameObject temp in tiles) { listSkillTiles.Add(temp.GetComponent <Tile>()); } }
public static void SubStats(AbstractGameObject ent, Stats stats) { ent.EntStats.SubStats(stats); ent.UpgradedStats.SubStats(stats); if (ClickManager.IsChoosed(ent.gameObject)) { UnitBar_HTML.UpdateInfo(ent); } }
// Use this for initialization void Start() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
private void ManageClicksWindow_Click(object sender, RoutedEventArgs e) { ClickManagerWindow window = new ClickManagerWindow { Owner = this }; if (window.ShowDialog() == true) { ClickManager.GetClickManager().SaveClicksToFile(); } }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } compared = new List <GameObject>(); }
void Awake() { Controller.eventPlay += UpdatePlay; Init(); GetUnitPosition(); scriptCM = GameObject.Find("ClickManager").GetComponent <ClickManager>(); ani = transform.gameObject.GetComponent <Animations>(); cam1 = scriptCM.cam1; cam2 = scriptCM.cam2; }
void Awake() { Instance = this; cameras[0].gameObject.SetActive(true); //初始化设置除主相机之外的相机不可用 for (int i = 1; i < cameras.Length; i++) { cameras[i].gameObject.SetActive(false); } nextBox.SetActive(false); //CameraActive(cameras[0], isActive[0]); //CameraNoActive(cameras[1], isActive[1]); }
private void Start() { if (UniversalVariables.haveTimersBeenSet == false) { firstTimer = Random.Range(firstTimerMin, firstTimerMax); secondTimer = Random.Range(secondTimerMin, secondTimerMax); StartCoroutine("FirstTimerCoro", firstTimer); UniversalVariables.haveTimersBeenSet = true; } randomiseOptions = GetComponentInParent <RandomiseOptions>(); clickManager = GetComponentInParent <ClickManager>(); }
private void Awake() { DontDestroyOnLoad(this); if (ManagerInstance == null) { ManagerInstance = this; } else { Object.Destroy(gameObject); } }
protected override void Awake() { base.Awake(); ClickManager.Instance(); ClickManager.OnClickAndRelease += PlayerMoveInputUpdate; if (!mainCamera) { mainCamera = FindObjectOfType <Camera>(); } lr = GetComponent <LineRenderer>(); }
//private SpriteRenderer spriteRenderer; // Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } //DontDestroyOnLoad (gameObject); //im trying a new instance for every level //DontDestroyOnLoad (puffin); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { instance = this; GameCenterManager.dispatcher.addEventListener (GameCenterManager.GAME_CENTER_PLAYER_AUTHENTICATED, OnPlayerAuth); GameCenterManager.init (); b = gameObject.AddComponent<ConectionButton> (); b.enabled = false; d = gameObject.AddComponent<DisconnectButton> (); d.enabled = false; m = gameObject.GetComponent<ClickManager> (); m.enabled = false; GameCenterMultiplayer.instance.addEventListener (GameCenterMultiplayer.PLAYER_DISCONNECTED, OnGCPlayerDisconnected); GameCenterMultiplayer.instance.addEventListener (GameCenterMultiplayer.MATCH_STARTED, OnGCMatchStart); }
//-------------------------------------- // INITIALIZE //-------------------------------------- void Awake() { instance = this; GameCenterManager.OnAuthFinished += OnAuthFinished; GameCenterManager.Init (); b = gameObject.AddComponent<ConnectionButton> (); b.enabled = false; d = gameObject.AddComponent<DisconnectButton> (); d.enabled = false; m = gameObject.GetComponent<ClickManager> (); m.enabled = false; GameCenter_RTM.ActionPlayerStateChanged += HandleActionPlayerStateChanged;; GameCenter_RTM.ActionMatchStarted += HandleActionMatchStarted; }
// Use this for initialization void Start() { ClickManagerParent = GetComponent<ClickManager> (); HasBeenHeld = false; }
// Use this for initialization void Start() { MainCam = GameObject.Find("Main Camera"); //load word files Nice = Resources.Load("Art assets/UI/In_Game/Excitement words/Nice") as Object; Great = Resources.Load("Art assets/UI/In_Game/Excitement words/Great") as Object; Awesome = Resources.Load("Art assets/UI/In_Game/Excitement words/Awesome") as Object; Fantastic = Resources.Load("Art assets/UI/In_Game/Excitement words/Fantastic") as Object; Wonderful = Resources.Load("Art assets/UI/In_Game/Excitement words/Wonderful") as Object; Amazing = Resources.Load("Art assets/UI/In_Game/Excitement words/Amazing") as Object; //load sound word files Nice1 = Resources.Load ("Sounds/Excitement_words/Nice1") as AudioClip; Nice2 = Resources.Load ("Sounds/Excitement_words/Nice2") as AudioClip; Great1 = Resources.Load ("Sounds/Excitement_words/Great1") as AudioClip; Great2 = Resources.Load ("Sounds/Excitement_words/Great2") as AudioClip; Awesome1 = Resources.Load ("Sounds/Excitement_words/Awesome1") as AudioClip; Awesome2 = Resources.Load ("Sounds/Excitement_words/Awesome2") as AudioClip; Fantastic1 = Resources.Load ("Sounds/Excitement_words/Fantastic1") as AudioClip; Fantastic2 = Resources.Load ("Sounds/Excitement_words/Fantastic2") as AudioClip; Wonderful1 = Resources.Load ("Sounds/Excitement_words/Wonderful1") as AudioClip; Wonderful2 = Resources.Load ("Sounds/Excitement_words/Wonderful2") as AudioClip; Amazing1 = Resources.Load ("Sounds/Excitement_words/Amazing1") as AudioClip; Amazing2 = Resources.Load ("Sounds/Excitement_words/Amazing2") as AudioClip; totalmatch = 0; ClickManagerParent = gameObject.transform.parent.transform.parent.GetComponent<ClickManager> (); Points = GameObject.Find ("Scripts"); Hit = Resources.Load ("Sounds/Squid-sounds/hit-2") as AudioClip; Cash = new AudioClip[5]; Cash[0] = Resources.Load ("Sounds/Octo_sounds/Coins/coin-drop-1") as AudioClip; Cash[1] = Resources.Load ("Sounds/Octo_sounds/Coins/coin-drop-2") as AudioClip; Cash[2] = Resources.Load ("Sounds/Octo_sounds/Coins/coin-drop-3") as AudioClip; Cash[3] = Resources.Load ("Sounds/Octo_sounds/Coins/coin-drop-4") as AudioClip; Cash[4] = Resources.Load ("Sounds/Octo_sounds/Coins/coin-drop-5") as AudioClip; FourDirections = new Ray[4]; FourHits = new RaycastHit[4]; ObjectsHits = new GameObject[4]; RealOrigin = new Vector3(gameObject.transform.parent.position.x + 0.05f, gameObject.transform.parent.position.y + 0.04f, gameObject.transform.parent.position.z - 0.3f); Match = new int[4]; roundcheck = false; FourDirections[0] = new Ray((RealOrigin), (2*gameObject.transform.parent.forward)); FourDirections[1] = new Ray((RealOrigin), (2*gameObject.transform.parent.right)); FourDirections[2] = new Ray((RealOrigin), (-2*(gameObject.transform.parent.forward))); FourDirections[3] = new Ray((RealOrigin), (-2*(gameObject.transform.parent.right))); for (int i=0; i<4; i++) { Debug.DrawRay(FourDirections[i].origin,FourDirections[i].direction, Color.blue, 5.0f); } //gameObject.GetComponent<SphereCollider>().enabled = false; for(int cross=0;cross<4;cross++) { if(Physics.Raycast(FourDirections[cross],out FourHits[cross], 2.0F)) { if( FourHits [cross].collider.gameObject!=null) { ObjectsHits [cross] = FourHits [cross].collider.gameObject; } } } //gameObject.GetComponent<SphereCollider>().enabled = true; }