Example #1
0
    void InstantiateNodes(int i, GameObject [] dummyNodes, GameObject SourcePrefab, GameObject parentNode)
    {
        GameObject currentBody = Instantiate(SourcePrefab) as GameObject;

        currentBody.transform.parent   = dummyNodes[i].transform.parent.transform;
        currentBody.transform.position = dummyNodes[i].transform.position;
        currentBody.transform.rotation = dummyNodes[i].transform.rotation;
        ActiveBodies.Add(currentBody);
        currentBody.name = ("" + dummyNodes[0].name + "" + i);
        starEnemy currentStarEnemy = currentBody.GetComponentInChildren <starEnemy>();

        currentStarEnemy.parent = currentBody;
        currentStarEnemy.AlertControllerOnDisable = parentNode;
        currentBody.GetComponentInChildren <EnemyHealth>().CollideParentToMessage = parentNode;
        // currentBody.GetComponentInChildren<EnemyHealth>().cantTakeDamage = true;
    }
    IEnumerator BeginSurroundBossProcess()
    {
        if (skipIntro)
        {
            InitialActivateDelay = 0;
        }

        yield return(new WaitForSeconds(InitialActivateDelay));

        // MoveNearPlayer();
        gameObject.transform.position = FollowObjectOverride.transform.position;

        normalFiringMode = false;
        fireNextNormal   = true;

        for (int i = 0; i < BodyIterations; i++)
        {
            GameObject currentBody = Instantiate(BodySource) as GameObject;
            currentBody.transform.parent           = SpinObject.transform;
            currentBody.transform.localEulerAngles = new Vector3(-90, 0, currentPlacementDegreeDistance);
            currentBody.transform.localPosition    = Vector3.zero;
            currentPlacementDegreeDistance         = currentPlacementDegreeDistance + DegreeDistance;
            body.Add(currentBody);
            currentBody.name = "boss_surround_body_" + i;
            starEnemy currentStarEnemy = currentBody.GetComponentInChildren <starEnemy>();
            currentStarEnemy.parent = currentBody;
            currentStarEnemy.AlertControllerOnDisable = gameObject;
            currentBody.GetComponentInChildren <EnemyHealth>().cantTakeDamage = true;
        }


        foreach (GameObject picked in body)
        {
            ActiveBodies.Add(picked);
            initRotationQuaternion.Add(picked, picked.transform.rotation);
        }


        for (int i = 0; i < body.Count; i++)
        {
            if (i % 2 == 0)
            {
                aboveBodies.Add(body[i]);
                depthDistanceAbove.Add(body[i], body[i].transform.localPosition.x);
                verticalDistanceAbove.Add(body[i], body[i].transform.localPosition.y);
            }

            else

            {
                belowBodies.Add(body[i]);
                depthDistanceBelow.Add(body[i], body[i].transform.localPosition.x);
                verticalDistanceBelow.Add(body[i], body[i].transform.localPosition.y);
            }
        }

        for (int i = 0; i < aboveBodies.Count; i++)
        {
            ActivatingBodyList.Add(aboveBodies[i]);
        }


        if (!Activate2ndReversed)
        {
            for (int i = 0; i < belowBodies.Count; i++)
            {
                ActivatingBodyList.Add(belowBodies[i]);
            }
        }

        else

        {
            // activates belowBodies in the reverse order of assignment, nice effect
            for (int i = belowBodies.Count; i-- > 0;)

            {
                ActivatingBodyList.Add(belowBodies[i]);
            }
        }

        // MoveNearPlayer();


        if (skipIntro)
        {
            foreach (GameObject picked in body)
            {
                picked.SetActive(true);
            }
        }
        // check for final and set normalFiringActive = true;
    }
Example #3
0
/// <summary>
/// UPDATE
/// </summary>


    void Update()
    {
        // print("bossphase is " + bossPhase);

        /*
         * if (starGameManagerRef == null)
         * {
         *  starGameManagerRef = StarGameManager.instance;
         * }
         */

        if (starGameManagerRef != null)
        {
            if (starShipController == null)
            {
                starShipController = starGameManagerRef.starShipController;
            }

            if (starGameManagerRef.GamePaused)
            {
                return;
            }
        }

        if (!starGameManagerRef.BossWarningMessagePlaying && !RanGenericBossTasks)
        {
            RunAfterWarningMessage();
        }

        if (debugSelectRandomBasherAttack)
        {
            debugSelectRandomBasherAttack = false;
            SelectCurrentRandomBasherAttack();
        }

        if (DebugBasherWeaponTestOverrideMode)
        {
            BasherWeaponTesting();
        }


        if (Garage != null)
        {
            if (phase2AlreadyActivated && !garageDestroyed)
            {
                if (!Garage.transform.parent.gameObject.activeSelf)
                {
                    Destroy(Garage);
                    garageDestroyed = true;
                }
            }
        }



        if (DisabledSubObjects.Count != 0)
        {
            List <GameObject> removeObjectList = new List <GameObject>();
            foreach (GameObject picked in DisabledSubObjects)
            {
                removeObjectList.Add(picked);
                GameObject currentSubObject = picked;
                ActiveBodiesUpdater(picked);

                if (bossPhase == BossPhase.BossPhase3)
                {
                    if (damagePanelLinks.ContainsKey(currentSubObject))
                    {
                        damagePanelLinks[currentSubObject].SetActive(true);
                        audioSource.PlayOneShot(DestroyPlowFragmentAudio);
                    }

                    if (AllActiveBodiesCleared)
                    {
                        BasherWeakpointVulnerable();
                    }
                }
            }

            foreach (GameObject picked in removeObjectList)
            {
                DisabledSubObjects.Remove(picked);
            }
        }



        if ((bossPhase == BossPhase.BossPhase1 && !phase2AlreadyActivated && AllActiveBodiesCleared) ||
            Debug_killMiniTanks)

        {
            Debug_killMiniTanks    = false;
            bossPhase              = BossPhase.BossPhase2;
            phase2AlreadyActivated = true;
            AllActiveBodiesCleared = false;

            if (!miniTanksMovedOutOfGarage)
            {
                miniTanksMovedOutOfGarage = true;
                GarageDoorAnimation(false);
            }

            for (int i = 0; i < IntactPanels.Length; i++)
            {
                ActiveBodies.Add(IntactPanels[i]);
            }

            SetPlowPanelsInvulnerable(true);

            StartCoroutine(BossBasherAppear());
        }


        if (bossPhase == BossPhase.BossPhase1)
        {
            if (!miniTanksMovedOutOfGarage)
            {
                if (ActiveBodies[ActiveBodies.Count - 1].transform.localPosition.z > MiniTanksBackDistance)
                {
                    miniTanksMovedOutOfGarage = true;
                    GarageDoorAnimation(false);
                }
            }

            for (int i = 0; i < miniTanksMoveForward.Count; i++)
            {
                miniTanksMoveForward[i].transform.Translate(0, MiniTanksDriveSpeed * Time.deltaTime, 0);
            }


            if (miniTanksMoveBackward.Count > 0)
            {
                if (miniTanksMoveBackward[miniTanksMoveBackward.Count - 1].transform.localPosition.z > MiniTanksBackDistance)
                {
                    for (int i = 0; i < miniTanksMoveBackward.Count; i++)
                    {
                        miniTanksMoveBackward[i].transform.Translate(0, -1 * MiniTanksDriveSpeed * Time.deltaTime, 0);
                    }
                }
            }
        }

        /*
         * // restore this if necessary for debug
         * if (phase2AlreadyActivated)
         * {
         *  // this might cause trouble??
         *  bossPhase = BossPhase.BossPhase2;
         *  phase2AlreadyActivated = false;
         * }
         */



        if (bossPhase == BossPhase.BossPhase3)
        {
            if (!deathPulseActive)
            {
                CheckForUserTooClose();

                if (UserAbove)
                {
                    BasherHatchPulse();
                    ResetUserPositionSensors();
                }
                else
                {
                    if (UserLeft)
                    {
                        animator.SetTrigger(WheelsPointLeft);
                        ResetUserPositionSensors();
                    }
                    else
                    {
                        if (UserRight)
                        {
                            animator.SetTrigger(WheelsPointRight);
                            ResetUserPositionSensors();
                        }
                    }
                }
            }
        }



        if (ActivateExplodeMesh)      // delete after debugging
        {
            ActivateExplodeMesh = false;
            BasherWeakpointVulnerable();
        }
    }  //end UPDATE