Example #1
0
        void Start()
        {
            GM = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>();
            am = GameObject.FindGameObjectWithTag("GameController").GetComponent <DialogueScript>().am;

            EmWeapons = GameObject.FindGameObjectWithTag("StarshineEnemyWeapons").GetComponent <EnemyWeapons>();

            Players = new GameObject[2];

            Players[0] = GameObject.FindGameObjectWithTag("WhitePlayer");
            Players[1] = GameObject.FindGameObjectWithTag("BlackPlayer");

            Target     = ChooseTarget();
            NumberShot = 0;
        }
        private void Start()
        {
            RB = GetComponent <Rigidbody2D>();
            SC = FindObjectOfType <StageController>();

            GM = FindObjectOfType <GameManager>();

            RB.AddForce(Vector2.down * MoveSpd);

            Health = Boss.Health[0];
            Shield = Boss.Shield[0];

            EmWeapons = FindObjectOfType <EnemyWeapons>();

            GetComponent <Animator>().enabled = false;
        }
        private IEnumerator CWIS_Shoot()
        {
            CWIS_Active = true;

            CWIS_Turret.transform.rotation = Quaternion.LookRotation(Vector3.forward, (CWIS_Turret.transform.position - CWISTargets[0].transform.position));

            if (!EmWeapons)
            {
                EmWeapons = FindObjectOfType <EnemyWeapons>();
            }

            GameObject newBolt = EmWeapons.GetBossBolt();

            newBolt.SetActive(true);
            newBolt.transform.position = transform.GetChild(0).transform.position;
            newBolt.transform.rotation = Quaternion.LookRotation(Vector3.forward, (CWISTargets[0].transform.position - newBolt.transform.position));

            newBolt.GetComponent <Rigidbody2D>().velocity = (CWISTargets[0].transform.GetChild(0).transform.position - newBolt.transform.position).normalized * 30;

            yield return(new WaitForSeconds(.1f));
        }
Example #4
0
        protected override void Start()
        {
            Cam       = Camera.main;
            CamBounds = Cam.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Cam.transform.position.z));

            EmWeapons = GameObject.FindGameObjectWithTag("StarshineEnemyWeapons").GetComponent <EnemyWeapons>();

            RB = GetComponent <Rigidbody2D>();

            Player1 = GameObject.FindGameObjectWithTag("WhitePlayer");
            Player2 = GameObject.FindGameObjectWithTag("BlackPlayer");

            IsEm = true;


            if (ShipType == EnemyShipType.Yari)
            {
                PlayerToTarget = ChooseTarget().gameObject;
            }

            if (GetComponent <Animator>())
            {
                Anim = GetComponent <Animator>();
            }


            switch (ShipType)
            {
            case EnemyShipType.Drone:
                break;

            case EnemyShipType.Yari:
                break;

            case EnemyShipType.Standard:
                break;

            case EnemyShipType.Rocket:

                RocketStart();

                break;

            default:
                break;
            }

            base.Start();

            if (IsEm)
            {
                if (Shield > 0)
                {
                    if (PlayerShip == Ships.CelestialDrone && transform.childCount > 0)
                    {
                        transform.GetChild(transform.childCount - 1).gameObject.SetActive(true);
                        ActiveShieldType = GetRandomShieldType();
                    }
                    else if (PlayerShip == Ships.CelestialRocketDrone)
                    {
                        transform.GetChild(4).gameObject.SetActive(true);
                        ActiveShieldType = GetRandomShieldType();
                    }

                    switch (ActiveShieldType)
                    {
                    case ShieldTypes.Bolts:
                        transform.GetChild(transform.childCount - 1).GetComponent <Renderer>().material.SetColor("shieldColor", Colours.BoltShieldColour);
                        break;

                    case ShieldTypes.Missiles:
                        transform.GetChild(transform.childCount - 1).GetComponent <Renderer>().material.SetColor("shieldColor", Colours.MissileShieldColour);
                        break;

                    default:
                        break;
                    }
                }
            }
        }