private void OnOvni(UfoController ufo) { GetComponent <Animator>().SetBool("OnOvni", true); CameraController.Instance.SmoothMoveToY(transform.position.y + 5f); ovniAttacked = ufo; ovniAttacked.UnderPlayer(); transform.rotation = Quaternion.identity; transform.parent = ovniAttacked.transform; statePlayer = StatePlayer.OnOVNI; rigidbody2d.bodyType = RigidbodyType2D.Static; }
public static void AddPoints(int amount) { Points += amount; UIController.SetScore(Points); AsteroidBuilder.SetSpawnInterval(AsteroidBuilder.BaseInterval - Points / AsteroidBuilder.PointsOverSecond); _ufoPointsCounter += amount; if (_ufoPointsCounter >= UFOPointsRequired) { _ufoPointsCounter -= UFOPointsRequired; UfoController.Spawn(); } }
public void Jump() { GetComponent <Animator>().SetBool("OnOvni", false); Debug.Log("Jumping"); rigidbody2d.bodyType = RigidbodyType2D.Dynamic; Vector3 direction = Vector3.up * 1500; if (ovniAttacked != null) { direction = ovniAttacked.transform.up * 1500; } rigidbody2d.AddForce(direction); statePlayer = StatePlayer.FLYING; transform.parent = null; // transform.localScale = Vector3.one; ovniAttacked = null; }
private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; var ufoControllers = FindObjectsOfType <UfoController>(); Ufo = ufoControllers.First(controller => controller.name.Contains("Ufo")); Alien = ufoControllers.First(controller => controller.name.Contains("alien")); Alien.gameObject.SetActive(false); if (Ufo == null) { Debug.LogError("No Ufo was found in the scene."); } }
private void Awake() { LoadPrefs(); Resources.UnloadUnusedAssets(); prev_width = Screen.width; prev_height = Screen.height; Restart_Button.onClick.AddListener(/*Restart*/ StartRestart); Options_Button.onClick.AddListener(Options); Menu_Button.onClick.AddListener(ReturnToMenu); Fullscreen_Button.onClick.AddListener(ToggleFullscreen); Particles_Button.onClick.AddListener(ToggleParticles); Effects_Button.onClick.AddListener(TogglePostProcessing); Res1440_Button.onClick.AddListener(() => { SetResolution(1440); }); Res1080_Button.onClick.AddListener(() => { SetResolution(1080); }); Res720_Button.onClick.AddListener(() => { SetResolution(720); }); setButtonOn(Fullscreen_Button, Screen.fullScreen); Fullscreen_Button.GetComponentInChildren <Text>().text = "FULLSCREEN: " + (Screen.fullScreen ? "ON" : "OFF"); setButtonOn(Particles_Button, PlayerPrefs.GetInt("screen_particles") == 1 ? true : false); Particles_Button.GetComponentInChildren <Text>().text = "SCREEN PARTICLES: " + (PlayerPrefs.GetInt("screen_particles") == 1 ? "ON" : "OFF"); setButtonOn(Effects_Button, postfxon); Effects_Button.GetComponentInChildren <Text>().text = "POST PROCESSING: " + (postfxon ? "ON" : "OFF"); MusicSlider.value = music_volume; SfxSlider.value = sfx_volume; Saving.text = ""; LoadData(); int i = 0; for (int j = 0; j < coin_count.Length; j++) { CoinIcons[j].GetComponent <Image>().color = new Color(1, 1, 1, coin_count[j] == 1 ? 1 : 0); Coins[i].gameObject.SetActive(coin_count[j] == 0); Coins[i + 1].gameObject.SetActive(coin_count[j] == 1); i += 2; } player = GameObject.Find("Player"); playerlight = GameObject.Find("Player Light Bright"); playerlight.SetActive(false); effects = GameObject.Find("EFFECTS"); globallight = GameObject.Find("Global Light"); cubecontroller = player.GetComponent <CubeController>(); autocontroller = player.GetComponent <AutoController>(); shipcontroller = player.GetComponent <ShipController>(); autoshipcontroller = player.GetComponent <AutoShipController>(); ufocontroller = player.GetComponent <UfoController>(); autoufocontroller = player.GetComponent <AutoUfoController>(); wavecontroller = player.GetComponent <WaveController>(); autowavecontroller = player.GetComponent <AutoWaveController>(); ballcontroller = player.GetComponent <BallController>(); autoballcontroller = player.GetComponent <AutoBallController>(); spidercontroller = player.GetComponent <SpiderController>(); autospidercontroller = player.GetComponent <AutoSpiderController>(); coptercontroller = player.GetComponent <CopterController>(); autocoptercontroller = player.GetComponent <AutoCopterController>(); //------------------------------------------------------------------------------------------------ playercontroller = cubecontroller; checkpointcontroller = FindObjectOfType <Checkpoint_Controller>(); playercontroller.setBGMusic(bgmusic.audio); newbgmusic = bgmusic; iconcontroller = FindObjectOfType <IconController>(); icon = iconcontroller.getIcon(); playercontroller.setIcons(icon); // ------------------------------------------------------------------------------------------------ /*channel_colors = new Color[color_channels.Length]; * int i = 0; * foreach(ColorReference c in color_channels) * { * channel_colors[i] = c.channelcolor; * if(c.refer != null) { channel_colors[i] = c.refer.channelcolor; } * i++; * }*/ // camera list ------------------------ cameraList = new List <CinemachineVirtualCamera>(); initialList = GameObject.FindGameObjectsWithTag("Camera"); i = 0; foreach (GameObject g in initialList) { cameraList.Add(g.GetComponent <CinemachineVirtualCamera>()); cameraList[i].gameObject.SetActive(true); cameraList[i].Priority = 5; } /*if (postfxon && main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>() != null) * { * main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>().enabled = true; * effects.SetActive(true); * } * else * { * main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>().enabled = false; * effects.SetActive(false); * }*/ }