void PowerCoreCollect() { Collider2D[] PowerCores = Physics2D.OverlapCircleAll(OriginPoint.position, detectRange, orbLayer); foreach (Collider2D PowerCore in PowerCores) { powerButton.enabled = true; if (dpadRef.IsRight) { PowerCore.GetComponent <diamondScript>().Collected(true); posNum++; } else if (dpadRef.IsLeft) { PowerCore.GetComponent <diamondScript>().Collected(true); PlayerAttackPower += baseDamage; negNum++; } } if (PowerCores.Length <= 0) { powerButton.enabled = false; } }
public void ConnectCore(PowerCore core) { connectedCore = core; Transform attachpointOffsetTransform = connectedCore.transform.Find("ConnectAttachPoint"); Debug.Log($"Core {core.name} connected to {name}"); connectedCore.transform.position = transform.position; connectedCore.transform.rotation = transform.rotation; connectedCore.transform.Translate(-attachpointOffsetTransform.localPosition, Space.Self); connectedCore.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; connectedCore.GetComponent <Rigidbody>().isKinematic = true; GetComponent <CapsuleCollider>().enabled = false; ghostCylinderPrefab.SetActive(false); if (audioSource == null) { Debug.LogWarning($"No audio source on Connect Point {name}"); } if (core.powered && audioSource != null) { audioSource.PlayOneShot(powerUpAudio); } }
private void AddPowerCore(PowerCore core) { PowerCoreGUI obj = Instantiate(PowerCoreGUI); obj.transform.SetParent(Content.transform, false); obj.AddPowerCore(core); }
public Observer(Color tint, Vector2 position, Entity2D target, List<Enemy> flockmates, PowerCore core) : base("observerEnemy", tint, position, target) { CurrentHealthPoints = MaxHealthPoints = 100; Path = new Flock(this, flockmates, core, target, 400, new Random().Next(75, 150)); Scale = 1.1f; Speed = 290f; FireRate = 2.5f; }
private void OnTriggerExit(Collider other) { PowerCore core = other.gameObject.GetComponentInParent <PowerCore>(); if (core != null) { Debug.Log("Ghost Mode Off"); ghostCylinderPrefab.SetActive(false); core.SetPointHovering(null); } }
private void OnTriggerEnter(Collider other) { PowerCore core = other.gameObject.GetComponentInParent <PowerCore>(); if (core != null) { // show ghost mode Debug.Log("Ghost Mode On"); ghostCylinderPrefab.SetActive(true); core.SetPointHovering(this); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); PowerCore powerCore = (PowerCore)target; if (GUILayout.Button("Generate ID")) { powerCore.powerCoreID = System.Guid.NewGuid().ToString(); EditorUtility.SetDirty(powerCore); } }
public void DisconnectCore() { connectedCore.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; GetComponent <CapsuleCollider>().enabled = true; Debug.Log($"Core {connectedCore.name} disconnected from {name}"); if (audioSource == null) { Debug.LogWarning($"No audio source on Connect Point {name}"); } if (connectedCore.powered && audioSource != null) { audioSource.PlayOneShot(powerDownAudio); } connectedCore = null; }
/// <summary> /// Creates a power core, the center of the game. /// </summary> /// <param name="spot"></param> /// <returns></returns> public PowerCore CreateCore(Vector2 spot) { GameObject go = _CreateObject(spot); go.name = "Core"; go.layer = 9; // PowerCore pc = go.AddComponent <PowerCore>(); pc.rb.constraints = RigidbodyConstraints2D.FreezeAll; // if (coreObj == null) { coreObj = pc; } return(pc); }
public IEnumerator CoreBreakRoutine(string node) { PowerCore brokenCore = null; PowerCore[] cores = FindObjectsOfType <PowerCore>(); List <PowerCore> pcList = new List <PowerCore>(); foreach (PowerCore core in cores) { if (core.powered)// && core.GetPoweredPoint() != "CommsConnectPoint") { pcList.Add(core); } } brokenCore = pcList[UnityEngine.Random.Range(0, pcList.Count - 1)]; if (brokenCore != null) { brokenCore.BurnOut(); } yield return(new WaitForSeconds(3f)); dialogueRunner.StartDialogue(node); }
public void AddPowerCore(PowerCore core) { PowerCore = core; ID.text = "ID: " + PowerCore.ID; }
public PowerCoreComponent(PowerCore equip, GameObject parent) : base(parent) { this.Equip = equip; CurrentThrustCapacity = Equip.ThrustCapacity; }
// Use this for initialization void Start() { earthQuake = false; attributesScript = GameObject.Find ("Player").GetComponent<PlayerAttributes> (); bossPowerCore = new PowerCore (); tempLoot = new LinkedList<InventoryItem> (); hudText = GameObject.Find ("HUD_Expand_Text").GetComponent<Text> (); //addEnemy (enemy1, new Vector3(-9.794984f, 8.99264f, 7.973226f)); addEnemy (enemy1, new Vector3(-9.79f, 8.99f, 7.97f)); addEnemy (enemy2, new Vector3(13.43f, 4.87f, -6.02f)); GameObject.Find ("Player").GetComponent<Sounds> ().playAmbienceSound (Sounds.TUTORIAL_AMBIENCE); }
// Use this for initialization void Start() { showingHowToPlay = true; gameRunning = false; fadeOut = false; playerBB = playerGO.GetComponent <BoxCollider2D>(); //powerCoreSR = powerCoreGO.GetComponent<SpriteRenderer>(); player = playerGO.GetComponent <Player>(); powerCore = powerCoreGO.GetComponent <PowerCore>(); floorBB = floor.GetComponent <BoxCollider2D>().bounds; staticBBs = new List <BoxCollider2D>(); for (int i = 0; i < LD39.Constants.TOTAL_POWER_GENERATORS; i++) { staticBBs.Add(powerGenerators[i].GetComponent <BoxCollider2D>()); } foreach (Transform child in propGO.transform) { staticBBs.Add(child.GetComponent <BoxCollider2D>()); } staticBBs.Add(consoleGO.GetComponent <BoxCollider2D>()); staticBBs.Add(coreHolder.GetComponent <BoxCollider2D>()); //Debug.Log("Total " + staticBBs.Count.ToString() + " (4 pg + props) static BB found"); updatePowerGenSpriteOrder(); expGenerated = 0; ExpBall.setPlayer(playerGO); coreHolderBound = coreHolder.GetComponent <BoxCollider2D>().bounds; float pad = 30.0f; Vector3 min = coreHolderBound.min; Vector3 max = coreHolderBound.max; min.x -= pad; min.y -= pad; max.x += pad; max.y += pad; coreHolderBound.SetMinMax(min, max); consoleBB = consoleGO.GetComponent <BoxCollider2D>().bounds; Vector3 consoleMin = consoleBB.min; //consoleMin.x -= pad; consoleMin.y -= pad; consoleBB.SetMinMax(consoleMin, consoleBB.max); consoleUI.GetComponent <Console>().init(); curAlertLevel = 0; maxAlertLevel = 100; alertBar.fillAmount = 0; gameOverEffect.GetComponent <Image>().color = new Color(1.0f, 1.0f, 1.0f, 0.0f); }