Esempio n. 1
0
        //====================================================================================================
        // ■ GUI
        //====================================================================================================
        void OnGUI()
        {
            if (Explosion == false)
            {
                UI.Color = COLOR.white;

                var camera   = GAMEOBJECT.Find("Main Camera").Camera;
                var position = camera.WorldToScreenPoint(Transform.Find("Bomb").Position);

                //Name
                UI.DrawLabel(new RECTANGLE(position.x, SCREEN.height - position.y, 200, 30), "" + BombCountDown, 20, true);

                //Energy

                /*			var eline = 100;
                 *
                 *                      UI.Color = (0, 0.4f, 0, 1);
                 *
                 *                      UI.DrawTexture(new RECTANGLE(position.x, SCREEN.height - position.y - 70, 100, 5), TEXTURE2D.whiteTexture);
                 *
                 *                      UI.Color = (0, 0.9f, 0, 1);
                 *
                 *                      UI.DrawTexture(new RECTANGLE(position.x, SCREEN.height - position.y - 70, eline, 5), TEXTURE2D.whiteTexture);
                 */
            }
        }
Esempio n. 2
0
        //====================================================================================================
        // ■ GUI
        //====================================================================================================
        void OnGUI()
        {
            if (HitFlag)
            {
                UI.Color = COLOR.white;

                var camera   = GAMEOBJECT.Find("Main Camera").Camera;
                var position = camera.WorldToScreenPoint(transform.position);

                //Energy

                UI.Color = (0, 0.4f, 0, 1);

                UI.DrawTexture(new RECTANGLE(position.x, SCREEN.height - position.y - 10, 30, 5), TEXTURE2D.whiteTexture);

                UI.Color = (0, 0.9f, 0, 1);

                UI.DrawTexture(new RECTANGLE(position.x, SCREEN.height - position.y - 10, 30 * HitCount / OriginalHitCount, 5), TEXTURE2D.whiteTexture);
            }

            if (Die)
            {
                UI.Color = COLOR.white;

                ScorePosition = math.lerp(ScorePosition, new float3(SCREEN.width * 0.5f, SCREEN.height, 0), 0.01f);

                //Number
                var rectangle = new RECTANGLE(ScorePosition.x - 60, SCREEN.height - ScorePosition.y, 30, 30);
                INTERFACE.DrawNumber(100, rectangle);
            }
        }
Esempio n. 3
0
        //====================================================================================================
        // ■ UPDATE
        //====================================================================================================
        void Update()
        {
            var position     = Transform.Position;
            var targetHeight = GAMEOBJECT.Find("Center").GetComponent <CENTER>().GetHeight();

            var l = 0.1f;

            Height             = math.lerp(Height, targetHeight, l);
            Transform.Position = math.normalize(position) * Height;

            Transform.Rotate(Axis, RotationSpeed * TIME.deltaTime);

            Transform.RotateAround(new float3(0, 0, 0), PlanetAxis, PlanetRotationSpeed * TIME.deltaTime);

            //Flash
            GameObject.Renderer.material.SetColor("_EmissionColor", new COLOR(FlashValue, FlashValue, FlashValue, 1));
            GameObject.Renderer.material.EnableKeyword("_EMISSION");

            FlashValue = math.lerp(0, FlashValue, 0.1f);

            //Hit Line
            if (TIME.realtimeSinceStartup - HitTime > 3)
            {
                HitFlag = false;
            }
        }
Esempio n. 4
0
        //----------------------------------------------------------------------------------------------------
        // ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


        //====================================================================================================
        // ■ START
        //====================================================================================================
        void Start()
        {
            //Laser Init
            LaserInstancesObject  = GAMEOBJECT.Find("Instances/Laser Instances");
            LeftLaserObject       = GAMEOBJECT.Find("MainShip/Laser Left");
            RightLaserObject      = GAMEOBJECT.Find("MainShip/Laser Right");
            FrontLeftLaserObject  = GAMEOBJECT.Find("MainShip/Laser Front Left");
            FrontRightLaserObject = GAMEOBJECT.Find("MainShip/Laser Front Right");

            WallInstances = GAMEOBJECT.Find("Instances/Wall Instances");
            WallObject    = GAMEOBJECT.Find("Instances/Wall Instances/WallObject");

            BombInstances = GAMEOBJECT.Find("Instances/Bomb Instances");
            BombObject    = GAMEOBJECT.Find("Instances/Bomb Instances/BombObject");

            LeftLaserObject.SetActive(false);
            RightLaserObject.SetActive(false);
            FrontLeftLaserObject.SetActive(false);
            FrontRightLaserObject.SetActive(false);

            WallObject.SetActive(false);

            BombObject.SetActive(false);

            LaserLastShotTime = LaserRepeatTime;

            Color = OriginalColor;

            PowerLoadTime  = TIME.realtimeSinceStartup;
            ShieldLoadTime = TIME.realtimeSinceStartup;
        }
Esempio n. 5
0
        //----------------------------------------------------------------------------------------------------
        // ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


        //====================================================================================================
        // ■ START
        //====================================================================================================
        void Start()
        {
            AsteroidInstances = GAMEOBJECT.Find("Instances/Asteroid Instances");
            AsteroidObject    = GAMEOBJECT.Find("Instances/Asteroid Instances/AsteroidObject");

            AddAsteroid();
            AddAsteroid();
            AddAsteroid();
            AddAsteroid();
        }
Esempio n. 6
0
        //----------------------------------------------------------------------------------------------------
        // ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


        //====================================================================================================
        // ■ START
        //====================================================================================================
        void Start()
        {
            Position = transform.position;
            Rotation = transform.rotation;

            var center = GAMEOBJECT.Find("Center").GetComponent <CENTER>();

            SpaceDistance = math.distance(transform.position, center.transform.position);

            TerrainDistance = SpaceDistance * 0.35f;

            Distance = SpaceDistance;
        }
Esempio n. 7
0
        //====================================================================================================
        // ■ UPDATE
        //====================================================================================================
        void Update()
        {
            if (AlienCount < AlienMaxCount)
            {
                var position = new float3(RANDOM.Float(-1, 1), RANDOM.Float(-1, 1), RANDOM.Float(-1, 1));
                var normal   = math.normalize(position);

                var height = GAMEOBJECT.Find("Center").GetComponent <CENTER>().GetHeight();

                position = math.normalize(position) * height;

                PutAlien(position, normal);
            }
        }
Esempio n. 8
0
        //====================================================================================================
        // ■ LATE UPDATE
        //====================================================================================================
        void LateUpdate()
        {
            var center = GAMEOBJECT.Find("Center").GetComponent <CENTER>();

            if (center.State == CENTER.STATE.Space)
            {
                Distance = math.lerp(Distance, SpaceDistance, 0.1f);
            }
            if (center.State == CENTER.STATE.Terrain)
            {
                Distance = math.lerp(Distance, TerrainDistance, 0.1f);
            }

            var targetPosition = center.transform.position - center.transform.forward * Distance;
            var targetRotation = quaternion.LookRotation(center.transform.forward, center.transform.up);

            transform.position = targetPosition;
            transform.rotation = targetRotation;
        }
Esempio n. 9
0
        //====================================================================================================
        // ■ HIT
        //====================================================================================================
        public void Hit(int hit = 1)
        {
            HitFlag = true;
            HitTime = TIME.realtimeSinceStartup;

            HitCount -= hit;
            HitCount  = math.max(0, HitCount);

            if (HitCount == 0)
            {
                PLAYER.AddScore(100);

                Destroy(GameObject, 1.0f);
                Die = true;

                var camera = GAMEOBJECT.Find("Main Camera").Camera;
                ScorePosition = camera.WorldToScreenPoint(transform.position);
            }

            Color = COLOR.white;
            Scale = 1.5f;

            GameObject.AudioSource.Play();
        }
Esempio n. 10
0
        //====================================================================================================
        // ■ UPDATE
        //====================================================================================================
        void Update()
        {
            var position     = Transform.Position;
            var targetHeight = GAMEOBJECT.Find("Center").GetComponent <CENTER>().GetHeight();
            var l            = 0.1f;

            if (Die)
            {
                targetHeight    = 1;
                l               = 0.03f;
                OriginalColor.a = 0;
            }

            Height             = math.lerp(Height, targetHeight, l);
            Transform.Position = math.normalize(position) * Height;

            //Flash
            Color.r = math.lerp(Color.r, OriginalColor.r, 0.03f);
            Color.g = math.lerp(Color.g, OriginalColor.g, 0.03f);
            Color.b = math.lerp(Color.b, OriginalColor.b, 0.03f);
            Color.a = math.lerp(Color.a, OriginalColor.a, 0.03f);
            var alien    = Transform.Find("Alien");
            var renderer = alien.GameObject.Renderer;
            var material = renderer.material;

            material.SetColor("_Color", Color);

            Scale = math.lerp(Scale, OriginalScale, 0.03f);
            alien.Transform.localScale = new float3(Scale);

            //Hit Line
            if (TIME.realtimeSinceStartup - HitTime > 3)
            {
                HitFlag = false;
            }
        }
Esempio n. 11
0
        //-----------------------------------------------------------------------------------------------------
        // ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


        //====================================================================================================
        // ■ START
        //====================================================================================================
        void Start()
        {
            AlienInstancesObject = GAMEOBJECT.Find("Instances/Alien Instances");
            AlienObject          = GAMEOBJECT.Find("Instances/Alien Instances/AlienObject");
            AlienObject.SetActive(false);
        }
Esempio n. 12
0
        //====================================================================================================
        // ■ UPDATE
        //====================================================================================================
        void Update()
        {
            var center = GAMEOBJECT.Find("Center").GetComponent <CENTER>();

            var position = center.transform.position;
            var rotation = center.transform.rotation;

            transform.position = math.lerp(transform.position, position, 5.0f * TIME.deltaTime);
            transform.rotation = math.slerp(transform.rotation, rotation, 5.0f * TIME.deltaTime);

            //Flash
            Color.r = math.lerp(Color.r, OriginalColor.r, 0.03f);
            Color.g = math.lerp(Color.g, OriginalColor.g, 0.03f);
            Color.b = math.lerp(Color.b, OriginalColor.b, 0.03f);
            var ship     = Transform.Find("Body/Ship");
            var renderer = ship.GameObject.Renderer;
            var material = renderer.material;

            material.SetColor("_EmissionColor", Color);


            //Set Height
            //			transform.position = Vector3.Normalize(transform.position - center) * ShipHeight;


            ////////////////////////////////
            /// WALL UPDATE
            ////////////////////////////////

            if (PLAYER.Shield > 0)
            {
                if (CurrentWall != null)
                {
                    var p = transform.position;

                    if (math.distance(p, OldPosition) > WallUpdateDistance)
                    {
                        CurrentWall.AddPoint(p);
                        OldPosition = p;

                        PLAYER.SubShield(1);
                    }
                }
            }
            else
            {
                StopWall();
            }


            ////////////////////////////////
            /// ITEM LOAD
            ////////////////////////////////

            if (PLAYER.GameOver == false)
            {
                //Power Load
                if (TIME.realtimeSinceStartup - PowerLoadTime > PowerLoadSpeed)
                {
                    PLAYER.AddPower(1);
                    PowerLoadTime = TIME.realtimeSinceStartup;
                }

                //Shield Load
                if (TIME.realtimeSinceStartup - ShieldLoadTime > ShieldLoadSpeed)
                {
                    PLAYER.AddShield(1);
                    ShieldLoadTime = TIME.realtimeSinceStartup;
                }
            }
        }
Esempio n. 13
0
        //----------------------------------------------------------------------------------------------------
        // ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■


        //====================================================================================================
        // ■ START
        //====================================================================================================
        void Start()
        {
            Center   = GAMEOBJECT.Find("Center").GetComponent <CENTER>();
            MainShip = GAMEOBJECT.Find("MainShip").GetComponent <MAINSHIP>();
        }
Esempio n. 14
0
        //*****************************************************************************************************

        //-----------------------------------------------------------------------------------------------------
        void Start()
        {
            FlameCenterObject = GAMEOBJECT.Find("MainShip/Flame/FlameCenter/Mesh");
            FlameSideObject   = GAMEOBJECT.Find("MainShip/Flame/FlameSide/Mesh");
        }