private void UpdateShieldRange(int sliderIndex) { ShieldController shieldController = Service.Get <ShieldController>(); BuildingUpgradeCatalog buildingUpgradeCatalog = Service.Get <BuildingUpgradeCatalog>(); BuildingTypeVO maxLevel = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup); int num = shieldController.PointsToRange[this.buildingInfo.ShieldRangePoints]; int num2 = shieldController.PointsToRange[maxLevel.ShieldRangePoints]; this.sliders[sliderIndex].CurrentSlider.Value = ((num2 == 0) ? 0f : ((float)num / (float)num2)); if (this.useUpgradeGroup) { BuildingTypeVO nextLevel = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo); int num3 = shieldController.PointsToRange[nextLevel.ShieldRangePoints]; this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(num); this.sliders[sliderIndex].NextLabel.Text = this.lang.Get("PLUS", new object[] { this.lang.ThousandsSeparated(num3 - num) }); this.sliders[sliderIndex].NextSlider.Value = ((num2 == 0) ? 0f : ((float)num3 / (float)num2)); return; } this.sliders[sliderIndex].CurrentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(num2) }); }
private void UpdateShieldHealth(int sliderIndex) { ShieldController shieldController = Service.ShieldController; BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog; BuildingTypeVO maxLevel = buildingUpgradeCatalog.GetMaxLevel(this.buildingInfo.UpgradeGroup); int num = shieldController.PointsToHealth[this.buildingInfo.ShieldHealthPoints]; int num2 = shieldController.PointsToHealth[maxLevel.ShieldHealthPoints]; this.sliders[sliderIndex].CurrentSlider.Value = ((num2 != 0) ? ((float)num / (float)num2) : 0f); if (this.useUpgradeGroup) { BuildingTypeVO nextLevel = buildingUpgradeCatalog.GetNextLevel(this.buildingInfo); int num3 = shieldController.PointsToHealth[nextLevel.ShieldHealthPoints]; this.sliders[sliderIndex].CurrentLabel.Text = this.lang.ThousandsSeparated(num); this.sliders[sliderIndex].NextLabel.Text = this.lang.Get("PLUS", new object[] { this.lang.ThousandsSeparated(num3 - num) }); this.sliders[sliderIndex].NextSlider.Value = ((num2 != 0) ? ((float)num3 / (float)num2) : 0f); } else { this.sliders[sliderIndex].CurrentLabel.Text = this.lang.Get("FRACTION", new object[] { this.lang.ThousandsSeparated(num), this.lang.ThousandsSeparated(num2) }); } }
// Start is called before the first frame update void Start() { cam = Camera.main; moveDirection.y = 0; shieldHealth = gm.GetPlayerShield(); shieldController = shield.GetComponent <ShieldController>(); }
protected override void OnShieldKnockBack(ShieldController target) { if (player.facingRight ()) { target.Knockback (new Vector2 (1, 0), shieldKnockback); } else { target.Knockback (new Vector2 (-1, 0), shieldKnockback); } }
public void SetShieldController(ShieldController sc) { if (sc != null) { shield = sc; } }
void Start() { m_Transform = transform; m_CameraTransform = Camera.main.transform; m_PlayerTransform = GameObject.FindGameObjectWithTag("Player").transform; m_EnemiesTransform = GameObject.FindGameObjectWithTag("Enemies").transform; m_ShieldsTransform = GameObject.FindGameObjectWithTag("Shields").transform; m_InGameUITransform = m_Transform.GetChild(3); m_PlayerController = m_PlayerTransform.gameObject.GetComponent <PlayerController>(); m_EnemyController = m_EnemiesTransform.gameObject.GetComponent <EnemyController>(); m_ShieldController = m_ShieldsTransform.gameObject.GetComponent <ShieldController>(); m_LivesText = GetComponentInChildren <LivesText>(); m_ScoreText = GetComponentInChildren <ScoreText>(); m_LevelText = GetComponentInChildren <LevelText>(); m_OriginalCameraPosition = m_CameraTransform.position; m_StartMenu = m_Transform.GetChild(0).gameObject; m_GameOverMenu = m_Transform.GetChild(1).gameObject; m_PauseMenu = m_Transform.GetChild(2).gameObject; m_InGameUI = m_Transform.GetChild(3).gameObject; m_ExplosionPrefab = Resources.Load <GameObject>("Prefabs/Explosion"); m_CanPause = false; DisableInGameUI(); }
public void Initialise(IComponentController shield) { Shield = (ShieldController)shield; ShieldNameLabel = transform.Find("ShieldName").GetComponent <Text>(); ShieldNameLabel.text = Shield.Name; TargetButton = transform.Find("TargetButton").GetComponent <Button>(); TargetButton.onClick.AddListener(StartTargeting); ArcButton = transform.Find("ArcButton").GetComponent <Button>(); ArcButton.onClick.AddListener(ToggleArc); DirectionSlider = transform.Find("DirectionSlider").GetComponent <Slider>(); DirectionSlider.onValueChanged.AddListener(SetDirection); DirectionSlider.value = Shield.GetRotationProportion(); DirectionSlider.interactable = (Shield.GetTarget() == null); RechargeToggle = transform.Find("RechargeToggle").GetComponent <Toggle>(); RechargeToggle.isOn = Shield.Recharging; RechargeToggle.onValueChanged.AddListener(SetRecharging); // store text color so we can set back labelColor = ShieldNameLabel.color; buttonColor = TargetButton.GetComponentInChildren <Text>().color; }
/** * For specific frame where player will throw the shield */ private void ThrowShield() { ShieldController shield = GameObject.Find("shield").GetComponent <ShieldController>(); Vector3 direction = Camera.main.transform.forward; Camera.main.transform.GetComponent <ThirdPersonCamera>().AimOff(); shield.Thrown(direction.normalized); }
protected override void OnShieldKnockBack(ShieldController target) { Vector2 launchDirection = target.transform.position - player.getTransform ().position; if (launchDirection.x >= 0) { target.Knockback (new Vector2 (1, 0), shieldKnockback); } else { target.Knockback (new Vector2 (-1, 0), shieldKnockback); } }
private void Awake() { // player는 계속 같은 자리에 존재하므로 Awake에서 Transform 가져온다. playerTransform = ShieldmanController.Instance.transform; // ??? 호출 너무 복잡... shield = ShieldmanController.Instance.gameObject.GetComponent <ShieldController>(); rb = gameObject.GetComponent <Rigidbody2D>(); }
private void Awake() { if (instance == null) { instance = this; gameObject.SetActive(false); } }
////////////FUNCTIONS///////// private void GetAllReferences() { // Finds references myRigidbody = GetComponent <Rigidbody2D>(); myAnimator = transform.GetComponentInChildren <Animator>(); myShield = gameObject.transform.Find("Shield").gameObject; myShieldController = myShield.GetComponent <ShieldController>(); myDeathExplosion = gameObject.transform.Find("DeathExplosion").gameObject; }
void Update() { if (gameObject.CompareTag("Shield") && shieldTimer != null) { lifetime -= Time.deltaTime; shieldController = gameObject.GetComponent <ShieldController> (); shieldTimer.text = "Shield : " + (int)lifetime + " seconds or " + shieldController.countUntillDestroy + " times"; } }
//Assigns skill values to shields private void ConfigureShield(ShieldController bc) { if (shieldHP == 0) { print("Check your shield HP value! might be 0!"); } bc.maxHP = shieldHP; //bc.regenRate = shieldRegen; //commented out since regen rate doesn't vary, according to joe }
void Start() { gameController = GameController.instance; shieldController = GetComponentInChildren <ShieldController>(); currentWeapon = weapons[Random.Range(0, weapons.Length)]; //currentWeapon = weapons[4]; gameController.SetFirerate(currentWeapon.fireRate); gameController.SetTimer(currentWeapon.weaponColor, currentWeapon.timeToChange); }
void Start() { Debug.Log("PlayerStart()"); playerRb = GetComponent <Rigidbody> (); playerTrans = GetComponent <Transform> (); speed = .75f; jumpPower = 1050.0f; jumpThreshold = 0.75f; fallOffValue = 5.0f; groundColliderContact = false; shootDirection = Vector3.left; health = 100; maxHealth = 100; playerShield = gameObject.GetComponent <ShieldController> (); playerShield.player = gameObject.GetComponent <PlayerController> (); playerMaterial = gameObject.GetComponent <MeshRenderer> ().material; baseColor = playerMaterial.color; playerGunController = gameObject.GetComponent <GunController> (); playerBombs = gameObject.GetComponent <BombController> (); cameraShake = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShaker> (); input = GameController.Instance.GetComponent <InputController> (); Debug.Log("Setting Controllers..."); input.SetGunController(playerGunController); input.SetShieldController(playerShield); input.SetBombController(playerBombs); //input.UpdateControllers (); Debug.Log("Finished setting Controllers."); GameObject audioObject = GameObject.FindGameObjectWithTag("AudioController"); Debug.Log(audioObject); if (audioObject != null) { Debug.Log("Found the audioObject!"); AudioSource[] audioSources = audioObject.GetComponents <AudioSource> (); spawnSound = audioSources [0]; damageSound = audioSources [1]; shotSound = audioSources [2]; deathSound = audioSources [3]; shieldSound = audioSources [4]; bombSound = audioSources [5]; spawnSound.Play(); } else { Debug.Log("Well, we never found the audioObject."); } }
// Use this for initialization void Start() { sm = new ShieldModel(); sv = new ShieldView(); sv.SetModel(sm); sv.SetUiText(TextShieldStrengthValue, TextRepairableValue); sv.Refresh(); sc = new ShieldController(); sc.SetModel(sm); sc.SetView(sv); }
private float ShieldActiveCD = 15f; //Cooldown before shields restart #endregion Fields #region Methods void Start() { EC = GetComponent<EnemyController>(); Shield = GetComponentInChildren<ShieldController>(); HC = GetComponent<HealthController>(); EBS = GetComponent<LMEnergyBallShot>(); IC = GameObject.FindGameObjectWithTag("Player").GetComponent<InventoryController>(); P = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>(); floor = P.getCurrentFloor() + 1; }
protected override void OnShieldKnockBack(ShieldController target) { if (player.facingRight()) { target.Knockback(new Vector2(-1, 0), shieldKnockback); } else { target.Knockback(new Vector2(1, 0), shieldKnockback); } }
public void Create(Ship ship) { // instantiate the ship prefab var shipClone = Instantiate(_chassisPrefabs[ship.ChassisType]); shipClone.gameObject.name = ship.Name; ShipController shipController = shipClone.GetComponent <ShipController>(); shipController.InitializeFromStruct(ship, _chassisTypes[ship.ChassisType]); // initialise power plant PowerController powerController = shipClone.GetComponentInChildren <PowerController>(); powerController.InitializeFromStruct(ship.PowerPlant, _powerPlantTypes[ship.PowerPlant.PowerPlantType]); // instantiate each shield foreach (Shield shield in ship.Shields) { var shieldClone = Instantiate(_shieldPrefabs[shield.ShieldType]); ShieldController shieldController = shieldClone.GetComponent <ShieldController>(); shieldController.InitialiseFromStruct(shield, _shieldTypes[shield.ShieldType]); // attach to the right hardpoint -- TODO add checking here that the hardpoint exists var hardpoint = shipClone.transform.Find(shield.HardpointName); shieldClone.SetParent(hardpoint, false); } // instantiate each weapon foreach (Weapon weapon in ship.Weapons) { var weaponClone = Instantiate(_weaponPrefabs[weapon.WeaponType]); WeaponController weaponController = weaponClone.GetComponent <WeaponController>(); weaponController.InitialiseFromStruct(weapon, _weaponTypes[weapon.WeaponType]); // attach to the right hardpoint -- TODO add checking here that the hardpoint exists var hardpoint = shipClone.transform.Find(weapon.HardpointName); weaponClone.SetParent(hardpoint, false); } // instantiate offscreen indicator var offscreenIndicatorClone = Instantiate(OffscreenIndicatorPrefab); OffscreenIndicatorController offscreenIndicatorController = offscreenIndicatorClone.GetComponent <OffscreenIndicatorController>(); offscreenIndicatorController.Target = shipClone; offscreenIndicatorClone.SetParent(OffscreenIndicatorParent); shipController.OffscreenIndicator = offscreenIndicatorController; // set the layer int layer = ship.Faction == "Friendly" ? GameManager.PLAYER_LAYER : GameManager.ENEMY_LAYER; shipClone.gameObject.SetLayer(layer); }
private void Start() { controller = gameObject.GetComponent <EnemyController>(); controller.SetCurrentHealth(maxHealth); controller.SetMaxHealth(maxHealth); player = GameObject.FindGameObjectWithTag("Player"); shield = player.transform.gameObject.GetComponent <ShieldController>(); run_spd = gameObject.transform.parent.GetComponent <FrontViewMove>().GetFrontViewSpeed() * 3f; animator = gameObject.GetComponent <Animator>(); parachute_anim = gameObject.transform.GetChild(0).gameObject.GetComponent <Animator>(); }
private void Start() { //model ShieldModel model = new ShieldModel(); //view ShieldView view = new ShieldView(); //controller ShieldController controller = new ShieldController(); view.SetUITexts(model.GetStrength(), model.IsRepairable()); }
// Start is called before the first frame update void Start() { gm = GameManager.instance; player = GameObject.FindWithTag("Player"); energyGain = gm.GetEnergyGain(); sc = player.GetComponent <PlayerController>().shieldGO.GetComponent <ShieldController>(); initialParent = gameObject.transform.parent; spawnParentGO = GameObject.FindWithTag("MapGOTagger"); goInstantiated = initialParent.gameObject; goInstantiated.transform.SetParent(spawnParentGO.transform); }
private void Start() { model = new ShieldModel(); view = new ShieldView(); view.SetModel(model); view.SetText(Strength, isRepairable); view.TextAfterChanges(); controller = new ShieldController(); controller.SetModel(model); controller.SetView(view); }
public void RemovePlayer() { Destroy(GetComponent <PlayerController>()); tag = "Alien"; GetComponent <SpriteRenderer>().color = color; Move(new Vector3(0, 0, 0)); ShieldController shieldController = GetComponent <ShieldController>(); if (shieldController) { shieldController.PlayerDetached(); } }
/** * What happens on start frame * * Gathers all components that are needed and initializes the object */ private void Start() { input = GameObject.Find("InputController").GetComponent <InputController>(); m_AnimFlags = gameObject.GetComponentInChildren <PlayerAnimationFlags>(); m_Anim = gameObject.GetComponentInChildren <Animator>(); m_Camera = Camera.main; m_Stats = GetComponent <Stats>(); m_ShieldController = GameObject.Find("shield").GetComponent <ShieldController>(); m_LeftFist = GameObject.Find("LeftFist").transform; m_RightFist = GameObject.Find("RightFist").transform; m_Foot = GameObject.Find("LeftFoot").transform; m_ShieldPoint = GameObject.Find("ShieldPoint").transform; }
private void Start() { player = GameObject.FindGameObjectWithTag("Player"); shield = player.transform.gameObject.GetComponent <ShieldController>(); // run_spd = gameObject.transform.parent.GetComponent<FrontViewMove>().GetFrontViewSpeed() * 2f; run_spd = 600f; // front move speed X 2 animator = gameObject.GetComponent <Animator>(); parachute_anim = gameObject.transform.GetChild(1).gameObject.GetComponent <Animator>(); // initial fire time is random count = Random.Range(0.5f, 1.5f); }
protected override void OnShieldKnockBack(ShieldController target) { Vector2 launchDirection = target.transform.position - player.getTransform().position; if (launchDirection.x >= 0) { target.Knockback(new Vector2(1, 0), shieldKnockback); } else { target.Knockback(new Vector2(-1, 0), shieldKnockback); } }
private void Start() { startTime = Time.time; player = GameObject.FindGameObjectWithTag("Player"); rb = gameObject.GetComponent <Rigidbody2D>(); animator = gameObject.GetComponent <Animator>(); shield = player.GetComponent <ShieldController>(); // setting bezier points points[0] = gameObject.transform.position + new Vector3(-50f, 0, 0); points[1] = gameObject.transform.position + new Vector3(-500f, height, 0); points[2] = player.transform.position + new Vector3(200f, height, 0); points[3] = player.transform.position; }
// Use this for initialization void Start() { model = new ShieldModel(); view = new ShieldView(); view.SetModel(model); view.SetUIItems(textStrength, textRepair, imageShield); view.SetImages(images); view.Refresh(); controller = new ShieldController(); controller.SetModel(model); controller.SetView(view); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.GetComponent <ShieldController>() != null) { ShieldController shield = other.gameObject.GetComponent <ShieldController>(); if (shield.ShieldLevel == 0) { return; } shield.AbsorbDamage(1000); //damage amount big enougth to drop down shield level TakeDamage(1000); } }
private void Start() { player = GameObject.FindGameObjectWithTag("Player").gameObject; shield = player.GetComponent <ShieldController>(); // 나중에 구조 바꿀것 rb = gameObject.GetComponent <Rigidbody2D>(); Vector3 dir = player.transform.position - gameObject.transform.position; rb.velocity = dir.normalized * speed; float angle = Mathf.Atan2(rb.velocity.y, rb.velocity.x) * Mathf.Rad2Deg; transform.rotation = Quaternion.AngleAxis(angle - 180, Vector3.forward); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.GetComponent <ShieldController>() != null) { ShieldController shield = other.gameObject.GetComponent <ShieldController>(); if (shield.ShieldLevel == 0) { return; } else { shield.AbsorbDamage(damagePower); DeactivateProjectile(); } } }
// Update is called once per frame void FixedUpdate() { if (gameController == null) { gameController = GameObject.FindGameObjectWithTag("GameController"); im = gameController.GetComponent<InputManager>(); } if (player != null) { if (eventTimer > 0) { eventTimer--; if (eventTimer == 0) { eventIndex++; refresh(); } } switch (eventIndex) { case 0: if (!dialogueSource.isPlaying) { eventIndex++; refresh(); } break; case 8: if (door1Upper.GetComponent<TutorialDoors>().open) { eventIndex++; refresh(); } break; } } else if (GameObject.FindGameObjectWithTag("Player") != null) { player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>(); player.freezeRotation(); player.rotateEnabled = false; player.verticalEnginesEnabled = false; player.longitudinalEnginesEnabled = false; player.lateralEnginesEnabled = false; player.weaponsEnabled = false; player.shieldEnabled = false; shield = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren<ShieldController>(); } }
protected virtual void OnShieldKnockBack(ShieldController target) { }
// Use this for initialization void Start() { Shield = GetComponentInChildren<ShieldController>(); }
void Awake() { current_health = max_health; Shield = GetComponentInChildren<ShieldController>(); AHC = GetComponentInChildren<AttackHit>(); if (Shield != null) HasShield = true; }
// Use this for initialization void Awake() { Cursor.lockState = CursorLockMode.Confined; audio_bullet = GetComponents<AudioSource>()[0]; //0: bullets, 1: engines, 2: shield, 3: impacts, 4: other audio_engineHum = GetComponents<AudioSource>()[1]; audio_engineHum.enabled = true; audio_engineHum.Play(); audio_accellerators = GetComponents<AudioSource>()[2]; audio_thrusters = GetComponents<AudioSource>()[3]; audio_hullHit = GetComponents<AudioSource>()[4]; audio_wallImpact = GetComponents<AudioSource>()[5]; audio_effects = GetComponents<AudioSource>()[6]; audio_bomb = GetComponents<AudioSource>()[7]; audio_accellerators_max_vol = audio_accellerators.volume; audio_thrusters_max_vol = audio_thrusters.volume; Time.timeScale = 1; // The time scale must be reset upon loading from the main menu rb = GetComponent<Rigidbody>(); originalColor = mesh.GetComponent<Renderer>().material.color; curPowerUp = powerUpList[0]; shield = GetComponentInChildren<ShieldController>(); bomb = GetComponentInChildren<BombController> (); maxHullIntegrity = currHullIntegrity = 5; armorGauge = gameObject.GetComponentInChildren<ArmorController>(); bombTimer = gameObject.GetComponentInChildren<BombCountdownController>(); deathEndingTimer = 0.0f; sceneTransition = GameObject.FindGameObjectWithTag("Screen Transition").GetComponent<CanvasGroup>(); transitionRate = 3; if (tutorialMode) { //Debug.Log("tutorial mode"); currHullIntegrity = 0; } Transform[] temp = bulletSpawns.GetComponentsInChildren<Transform>(); bulletSpawnLocations = new Transform[temp.Length - 1]; bulletSpawnLocIndex = 0; for(int i = 0; i < temp.Length; ++i) { if(temp[i].gameObject.GetInstanceID() != bulletSpawns.GetInstanceID()) { bulletSpawnLocations[bulletSpawnLocIndex] = temp[i]; ++bulletSpawnLocIndex; } } if (GameObject.Find("GameController") == null) { Instantiate(gameController); } gameController = GameObject.FindGameObjectWithTag("GameController"); im = gameController.GetComponent<InputManager>(); mainThrusterLeft.Play (); mainThrusterRight.Play (); }
void Start() { //NEW CODE HERE GameObject shieldControllerObject = GameObject.FindWithTag("ShieldController"); GameObject playerHealthObject = GameObject.FindWithTag("Health"); GameObject gameControllerObject = GameObject.FindWithTag("GameController"); GameObject shotSpawnObject = GameObject.FindWithTag("ShotSpawn"); GameObject camShakeControllerObject = GameObject.FindWithTag("MainCamera"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent<GameController>(); camShake = camShakeControllerObject.GetComponent<cameraShake>(); } if (playerHealthObject!=null) { playerHealth = playerHealthObject.GetComponent<PlayerHealth>(); } if (shieldControllerObject != null) { shieldController = shieldControllerObject.GetComponent<ShieldController>(); } if (shotSpawnObject != null) { shotSpawnController = shotSpawnObject.GetComponent<ShotSpawn>(); } fileName = "shoot"; file = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt"); //LoadShot(); if (PlayerPrefs.HasKey("Shot")) { loadedFireType = PlayerPrefs.GetInt("Shot"); } else { loadedFireType = 1; } fireType = loadedFireType; rigidBody = gameObject.GetComponent<Rigidbody2D>(); }
//тип 6 номер 6 public void Shieldcontroller(ShieldController sh, RootCharacterController c, WeaponClass w, int n, int b,int cN, SpFunctions s, clavisher cl) { if (sh.stage == 0) sh.SetValues (c, w, n, b, cN, s, cl); sh.Work (); }
//Assigns skill values to shields private void ConfigureShield(ShieldController bc) { if (shieldHP == 0) print ("Check your shield HP value! might be 0!"); bc.maxHP = shieldHP; //bc.regenRate = shieldRegen; //commented out since regen rate doesn't vary, according to joe }