void Damage(Transform enemy) { CoreScript e = enemy.GetComponent <CoreScript> (); if (e != null) { e.CoreTakeDamage(damage); } }
void UseObjectWithMachine() { // I hit a machine // do some stuff to update the machine and bool shouldAttachObject = false; switch (m_MachineHit.transform.tag) { case "Core": CoreScript core = GetHitComponent <CoreScript>(m_MachineHit); if (IsHoldingWithTag("PowerCell")) { shouldAttachObject = core.AddPower(m_Object, GetHeldCellCharge()); } else if (IsHoldingWithTag("CoolingCell")) { shouldAttachObject = core.AddCooling(m_Object, GetHeldCellCharge()); } break; case "Filter": FilterScript filter = GetHitComponent <FilterScript>(m_MachineHit); if (IsHoldingWithTag("FilterPickup")) { shouldAttachObject = filter.InsertFilter(m_Object); } break; case "Refiner": RefinerScript refiner = GetHitComponent <RefinerScript>(m_MachineHit); if (IsHoldingWithTag("PowerCell")) { shouldAttachObject = refiner.InsertCell(m_Object); } break; case "Radiator": RadiatorScript radiator = GetHitComponent <RadiatorScript>(m_MachineHit); if (IsHoldingWithTag("CoolingCell")) { shouldAttachObject = radiator.InsertCell(m_Object); } break; } // should only destroy if the interaction makes sense if (shouldAttachObject) { AttachObject(); } }
void Awake() { maincontroller = GameObject.Find("GameController").GetComponent <MainController>(); enemycontroller = GameObject.FindGameObjectWithTag("GameManeger").GetComponent <EnemyManager>(); corelife = GameObject.FindGameObjectWithTag("Core").GetComponent <CoreScript>(); lifeui = GameObject.Find("Canvas").transform.Find("PlayerHealth").GetComponent <lifeUI>(); scorescript = GameObject.Find("Canvas").transform.Find("ScoreText").GetComponent <ScoreText_Animation>(); DamegeEffectObj = GameObject.FindGameObjectWithTag("Effect/Player").gameObject; DamegeEffect = DamegeEffectObj.GetComponent <ParticleSystem>(); BomEffect = GameObject.FindGameObjectWithTag("Effect/Bom").GetComponent <ParticleSystem>(); playerrender = GetComponent <SpriteRenderer>(); AudioPlayerShot = GameObject.Find("Audio").transform.Find("Playershot").GetComponent <AudioSource>(); Audiopower_up = GameObject.Find("Audio").transform.Find("power_up").GetComponent <AudioSource>(); AudioCorekaifuku = GameObject.Find("Audio").transform.Find("Corekaifuku").GetComponent <AudioSource>(); AudioOptionSpawn = GameObject.Find("Audio").transform.Find("OptionSpawn").GetComponent <AudioSource>(); AudioDamage = GameObject.Find("Audio").transform.Find("damage").GetComponent <AudioSource>(); }
private void Awake() { name = GetComponent <SpriteRenderer>().sprite.name; manipulatorScript = Camera.main.GetComponent <ManipulatorScript>(); cScript = GameObject.Find("CoreManager").GetComponent <CoreScript>(); gScript = GetComponent <GroupScript>(); gScript.inGroup = true; if (!enabled) { return; } allies.Clear(); alliesNames.Clear(); allies.Add(gameObject); alliesNames.Add(name); collectedAllies.Add(name); collectedAlliesCurrent.Add(name); spawnPositions.Add(transform.position); //gScript.rb.bodyType = RigidbodyType2D.Static; block = true; Physics2D.autoSimulation = false; }
void Awake() { mainCamera = Camera.main; coreScript = GetComponent<CoreScript>(); m_fieldPoint = Vector2.zero; }