예제 #1
0
    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;
        }
    }
예제 #2
0
    [SerializeField] string backToTheTitleScreen   = null;                        // Allows the User to type in the Title Screen Scene that will be used for this button.

    void Start()
    {
        // Obtains the components from the PlayerMovement, CameraFollow and BlasterManager Script.
        playerMovementController = FindObjectOfType <PlayerMovement>();
        armMovementController    = FindObjectOfType <BlasterManager>();
        cameraMovementController = FindObjectOfType <CameraFollow>();
    }
예제 #3
0
 void Start()
 {
     // Obtains the components from the PlayerMovement, CameraFollow and BlasterManager Script.
     playerMovementController = FindObjectOfType<PlayerMovement>();
     armMovementController = FindObjectOfType<BlasterManager>();
     cameraMovementController = FindObjectOfType<CameraFollow>();
 }
예제 #4
0
    bool greenBlasterMode;                                          // Used to hold the Diffusion Mode boolean value in the Blaster Manager Script.

    void Start()
    {
        // First finds the modeIcon GameObject and then obtains the Image components.
        modeIcon = GameObject.Find("ModeIcon").GetComponent <Image>();
        // 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.
        blasterManager = armBlasterContainer.GetComponent <BlasterManager>();

        if (healthBarRectangle == null)
        {
            // Provides a visible alert in the Unity Editor's Console Log.
            Debug.LogError("Status Indicator: No health bar object referenced!");
        }

        if (healthText == null)
        {
            // Provides a visible alert in the Unity Editor's Console Log.
            Debug.LogError("Stauts Indicator: No health text object referenced!");
        }

        if (modeIcon == null)
        {
            // Provides a visible alert in the Unity Editor's Console Log.
            Debug.LogError("Stauts Indicator: No mode icon object referenced!");
        }
    }
예제 #5
0
    [HideInInspector] Vector2 direction;                              // Used to hold changes made to the x and y axis.

    void Start()
    {
        // Obtains the components from the Controller2D and BlasterManager Script.
        playerController = FindObjectOfType <Controller2D>();
        arm = FindObjectOfType <BlasterManager>();

        // Checks to see if the Player's arm has not rotated.
        if (arm.transform.localRotation.z == 0.0f)
        {
            // Checks to see if the Player isn't holding up or down when shooting
            // or if the Player is shooting when holding down on the ground.
            if (Input.GetAxisRaw("VerticalMove") == 0 ||
                (Input.GetAxisRaw("VerticalMove") == -1 && playerController.collisions.below))
            {
                // Checks to see if the Player is moving/facing right.
                if (playerController.transform.localScale.x > 0)
                {
                    // Used to make the Player shoot towards the right.
                    direction = new Vector2(shotSpeed, 0);
                }

                // Checks to see if the Player is moving/facing left.
                if (playerController.transform.localScale.x < 0)
                {
                    // Used to make the Player shoot towards the left.
                    direction = new Vector2(-shotSpeed, 0);
                }
            }
        }

        // Checks to see if the Player's arm has rotated 90 degrees.
        if (arm.transform.localRotation.z > 0.70f)
        {
            // Checks to see if the Player is holding up.
            if (Input.GetAxisRaw("VerticalMove") == 1)
            {
                // Used to make the Player shoot upwards.
                direction = new Vector2(0, shotSpeed);
            }

            // Checks to see if the Player is holding down.
            if (Input.GetAxisRaw("VerticalMove") == -1)
            {
                // Used to make the Player shoot downwards.
                direction = new Vector2(0, -shotSpeed);
            }
        }
    }
예제 #6
0
    int shotSpeed = 10; // The speed the shot can travel in the x and y axis.

    #endregion Fields

    #region Methods

    void Start()
    {
        // Obtains the components from the Controller2D and BlasterManager Script.
        playerController = FindObjectOfType<Controller2D>();
        arm = FindObjectOfType<BlasterManager>();

        // Checks to see if the Player's arm has not rotated.
           if (arm.transform.localRotation.z == 0.0f) {
            // Checks to see if the Player isn't holding up or down when shooting
            // or if the Player is shooting when holding down on the ground.
            if (Input.GetAxisRaw("VerticalMove") == 0
                || (Input.GetAxisRaw("VerticalMove") == -1 && playerController.collisions.below )) {
                // Checks to see if the Player is moving/facing right.
                if (playerController.transform.localScale.x > 0) {
                    // Used to make the Player shoot towards the right.
                    direction = new Vector2(shotSpeed, 0);
                }

                // Checks to see if the Player is moving/facing left.
                if (playerController.transform.localScale.x < 0) {
                    // Used to make the Player shoot towards the left.
                    direction = new Vector2(-shotSpeed, 0);
                }
            }
        }

        // Checks to see if the Player's arm has rotated 90 degrees.
        if (arm.transform.localRotation.z > 0.70f) {
            // Checks to see if the Player is holding up.
            if (Input.GetAxisRaw("VerticalMove") == 1) {
                // Used to make the Player shoot upwards.
                direction = new Vector2(0, shotSpeed);
            }

            // Checks to see if the Player is holding down.
            if (Input.GetAxisRaw("VerticalMove") == -1) {
                // Used to make the Player shoot downwards.
                direction = new Vector2(0, -shotSpeed);
            }
        }
    }
예제 #7
0
    void Start()
    {
        // First finds the modeIcon GameObject and then obtains the Image components.
        modeIcon = GameObject.Find("ModeIcon").GetComponent<Image>();
        // 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.
        blasterManager = armBlasterContainer.GetComponent<BlasterManager>();

        if (healthBarRectangle == null) {
            // Provides a visible alert in the Unity Editor's Console Log.
            Debug.LogError("Status Indicator: No health bar object referenced!");
        }

        if (healthText == null) {
            // Provides a visible alert in the Unity Editor's Console Log.
            Debug.LogError("Stauts Indicator: No health text object referenced!");
        }

        if (modeIcon == null) {
            // Provides a visible alert in the Unity Editor's Console Log.
            Debug.LogError("Stauts Indicator: No mode icon object referenced!");
        }
    }
예제 #8
0
 void Start()
 {
     // Obtains the components from the BlasterManager script.
     blasterManager = GetComponent<BlasterManager>();
 }
예제 #9
0
    BlasterManager blasterManager;                                // References the BlasterManager configurations.

    void Start()
    {
        // Obtains the components from the BlasterManager script.
        blasterManager = GetComponent <BlasterManager>();
    }
예제 #10
0
    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;
        }
    }