void Start() { // Obtains the components from the Controller2D script. playerControl = GetComponentInParent <Controller2D>(); // Obtains the components from the BlasterManager script. blasterManager = FindObjectOfType <BlasterManager>(); // Obtains the components from the PrefabBlasterManager script. prefabBlasterManager = GetComponent <PrefabBlasterManager>(); // Obtains the components from the BlasterCalculations script. blasterCalculations = GetComponent <BlasterCalculations>(); // If all 4 locks (power, magnetic, thermal and diffusion) are false, make powerModeIsOn true by default. if (powerModeIsOn == false && magneticModeIsOn == false && thermalModeIsOn == false && diffusionModeIsOn == false) { // powerModeIsOn will become true when everything else is (or becomes) false. powerModeIsOn = true; } // If all 4 checks (standard, charging, charged, and second charged) are false, make isThisAStandardShot true by default. if (isThisAStandardShot == false && isThisAChargingShot == false && isThisAChargedShot == false && isThisASecondChargedShot == false) { // isThisAStandardShot will become true when everything else is (or becomes) false. isThisAStandardShot = true; } }
void Start() { // Obtains the components from the PrefabBlasterManager script. prefabBlasterManager = GetComponent<PrefabBlasterManager>(); // Obtains the components from the BlasterCalculations script. blasterCalculations = GetComponent<BlasterCalculations>(); // Obtains the components and scripts from the Arm GameObject on the Player. GameObject armBlasterContainer = GameObject.Find("Arm"); // Has access to all of the public variables located within PrefabBlasterManager. prefabBlasterManager = armBlasterContainer.GetComponent<PrefabBlasterManager>(); // Passes the impactEffect GameObject from the PrefabBlasterManager to the shotImpactEffect here. shotImpactEffect = prefabBlasterManager.impactEffect; // Has access to all of the public variables located within BlasterCalculations. blasterCalculations = armBlasterContainer.GetComponent<BlasterCalculations>(); // Passes the numeric damage amount from BlasterCalculations to the shotBlasterDamage here. shotBlasterDamage = blasterCalculations.blasterDamage; Debug.Log(blasterCalculations.blasterDamage); }
PrefabBlasterManager prefabBlasterManager; // References the PrefabBlasterManager configurations. void Start() { // Obtains the components from the PrefabBlasterManager script. prefabBlasterManager = GetComponent <PrefabBlasterManager>(); // Obtains the components from the BlasterCalculations script. blasterCalculations = GetComponent <BlasterCalculations>(); // Obtains the components and scripts from the Arm GameObject on the Player. GameObject armBlasterContainer = GameObject.Find("Arm"); // Has access to all of the public variables located within PrefabBlasterManager. prefabBlasterManager = armBlasterContainer.GetComponent <PrefabBlasterManager>(); // Passes the impactEffect GameObject from the PrefabBlasterManager to the shotImpactEffect here. shotImpactEffect = prefabBlasterManager.impactEffect; // Has access to all of the public variables located within BlasterCalculations. blasterCalculations = armBlasterContainer.GetComponent <BlasterCalculations>(); // Passes the numeric damage amount from BlasterCalculations to the shotBlasterDamage here. shotBlasterDamage = blasterCalculations.blasterDamage; Debug.Log(blasterCalculations.blasterDamage); }
void Start() { // Obtains the components from the Controller2D script. playerControl = GetComponentInParent<Controller2D>(); // Obtains the components from the BlasterManager script. blasterManager = FindObjectOfType<BlasterManager>(); // Obtains the components from the PrefabBlasterManager script. prefabBlasterManager = GetComponent<PrefabBlasterManager>(); // Obtains the components from the BlasterCalculations script. blasterCalculations = GetComponent<BlasterCalculations>(); // If all 4 locks (power, magnetic, thermal and diffusion) are false, make powerModeIsOn true by default. if (powerModeIsOn == false && magneticModeIsOn == false && thermalModeIsOn == false && diffusionModeIsOn == false) { // powerModeIsOn will become true when everything else is (or becomes) false. powerModeIsOn = true; } // If all 4 checks (standard, charging, charged, and second charged) are false, make isThisAStandardShot true by default. if (isThisAStandardShot == false && isThisAChargingShot == false && isThisAChargedShot == false && isThisASecondChargedShot == false) { // isThisAStandardShot will become true when everything else is (or becomes) false. isThisAStandardShot = true; } }