Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        startx           = Screen.width / 4;
        starty           = Screen.height / 4;
        orb_offset       = 160;
        orb_color_offset = 185;

        GameObject s = GameObject.Find("game_state");

        state = s.GetComponent <Game_State>();

        //increment level order if player has gotten enough points
        if (Manager.points >= Manager.req_points && state.cur_level < state.level_order.Length - 1)
        {
            state.cur_level++;
        }

        //instantiate visual representations of objects next to text

        /*	GameObject starE = Instantiate (star, Camera.main.ScreenToWorldPoint(new Vector3(startx+orb_offset-30, starty+50, 30)), new Quaternion(0,0,0,0)) as GameObject;
         *      GameObject coin_actual = Instantiate(coin, Camera.main.ScreenToWorldPoint(new Vector3(startx+orb_offset-30, starty+120, 30)), new Quaternion (90, 0, 0, 0)) as GameObject;
         *      GameObject boost_actual= Instantiate(boost, Camera.main.ScreenToWorldPoint(new Vector3(startx+orb_offset-30, starty+80, 30)), new Quaternion (0, 0, 0, 0)) as GameObject;
         *      boost_actual.transform.localScale /= 15;
         *      coin_actual.transform.Rotate(90,0,0);
         *      coin_actual.transform.localScale /= 5;
         *      Starscript script = starE.GetComponent<Starscript>();
         *      script.c = Color.red;
         *      starE.transform.localScale /= 3;*/
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        this.turn              = 0;
        this.max_player        = 2;
        this.max_sphere_amount = 2;

        _sp1 = new List <GameObject>();
        _sp2 = new List <GameObject>();
        _ob  = new List <GameObject>();

        //가로모드 고정
        Screen.orientation = ScreenOrientation.Landscape;

        cur_game_state = Game_State.Intro;

        Main_Cam = GameObject.Find("Main Camera").gameObject;                  //메인 카메라
        //카메라
        cam_rotation_angle = 0;
        //기타 UI
        Touch_To_Start = GameObject.Find("Text").gameObject;
        logo           = GameObject.Find("Logo");
        //back=GameObject.Find("Back");
        Text_GameOver = GameObject.Find("Text_GameOver");
        Black_out     = GameObject.Find("Black_out");
        //back.SetActive(false);
        Text_tick = 0;
        T_Switch  = 1;

        //게임 컴포넌트들을 가지고 온다.
        Sphere1  = Resources.Load("Sphere1") as GameObject;
        Sphere2  = Resources.Load("Sphere2") as GameObject;
        Obstacle = Resources.Load("Obstacle") as GameObject;
        m        = Resources.Load("Smoke Trail") as GameObject;
        m.GetComponent <Renderer>().sharedMaterial.SetColor("_TintColor", new Vector4(1f, .54f, .66f, 1f));
    }
Esempio n. 3
0
 private void GameLoadConfigState()
 {
     GenerateTiles(VRWorld.mainTiles);
     //SendClientUIReady();
     StartCoroutine(UIReadyAfterTime(1));
     m_gameState = Game_State.ConfigLoaded;
 }
Esempio n. 4
0
 public void enter_state(Game_State state)
 {
     states.Push(state);
     top_state = state;
     time      = state.update_t;
     state.init();
 }
 //--------------------------------------------------------------------
 // ● 更新(開始)
 //--------------------------------------------------------------------
 void update_start()
 {
     if (start_second < Time.time || Input.GetKeyDown(KeyCode.Space))
     {
         game_state = Game_State.GAME;
     }
 }
Esempio n. 6
0
    void Change_State()
    {
        switch (State)
        {
        case Game_State.Game_Bagin:
            break;

        case Game_State.Game_Level:
            break;

        case Game_State.Game_Stop:
            break;

        case Game_State.Game_Over:
            break;

        case Game_State.Game_Player:
            int temp = player.ChoosePerson();
            preState = Game_State.Game_Player;
            player.changestate();
            break;

        case Game_State.Game_Enemy:
            preState = Game_State.Game_Enemy;
            AI.change_state();
            break;

        case Game_State.Game_Supply:
            //supply.XXXXX
            break;
        }
    }
Esempio n. 7
0
 // Use this for initialization
 void Start()
 {
     GameObject gs = GameObject.Find("game_state");
     gscpt = gs.GetComponent<Game_State>();
     bomb_out = false;
     last_bomb = Time.time - cool_down;
 }
Esempio n. 8
0
 public void Loading()
 {
     _eGame_State = Game_State.Game;
     _bStart_Game = true;
     _gGame_Camera.SetActive(true);
     _gStart_Area.SetActive(false);
     gameObject.GetComponent <AudioSource>().Play();
 }
Esempio n. 9
0
 // Use this for initialization
 void Start()
 {
     State    = Game_State.Game_Enemy;
     preState = Game_State.Game_Player;
     player   = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <Player_controller>();
     AI       = GameObject.FindGameObjectWithTag("AIController").GetComponent <AIConrtoller>();
     supply   = GameObject.FindGameObjectWithTag("GameSupply").GetComponent <Supply>();
 }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        GameObject gs = GameObject.Find("game_state");

        gscpt     = gs.GetComponent <Game_State>();
        bomb_out  = false;
        last_bomb = Time.time - cool_down;
    }
Esempio n. 11
0
    // Update is called once per frame
    void Update()
    {
        if (_fPlayer_HP <= 0 || _fGame_Time <= 0)
        {
            _eGame_State = Game_State.End;
        }

        switch (_eGame_State)
        {
        case Game_State.Start:
            if (SteamVR_Actions.default_InteractUI.GetStateDown(SteamVR_Input_Sources.Any) || Input.GetKeyDown(KeyCode.F10))
            {
                //_gGame_Camera.SetActive(true);
                // m_LogoCamera.position = _gGame_Camera.transform.position;
                m_LogoCamera.gameObject.GetComponent <Camera>().cullingMask = -1;
                _aStart_UI.SetTrigger("Open");
                _gController.SetActive(false);
                Start_Loading();
            }
            break;

        case Game_State.Loading:
            if (m_LogoHex != null)
            {
                m_LogoHex.material.SetFloat("_deformation_type_Factor", 1.0f - m_Alpha);
                Color _BC = m_LogoHex.material.GetColor("_BackFace_Color");
                m_LogoHex.material.SetColor("_BackFace_Color", new Color(_BC.r, _BC.g, _BC.b, m_Alpha));
            }

            if (m_LogoUI != null)
            {
                m_LogoUI.alpha = m_Alpha;
            }
            break;

        case Game_State.End:
            _gEnd_Area.SetActive(true);
            _gGame_Camera.SetActive(false);
            _gController.SetActive(true);
            _gBug_Area.SetActive(false);
            if (SteamVR_Actions.default_InteractUI.GetStateDown(SteamVR_Input_Sources.Any) || Input.GetKeyDown(KeyCode.F10))
            {
                SceneManager.LoadScene(0);
            }
            break;
        }
        if (_bStart_Game == true && _eGame_State == Game_State.Game)
        {
            _fGame_Time      -= Time.deltaTime;
            _iTime.fillAmount = _fGame_Time / 60;
            _iHP.fillAmount   = _fPlayer_HP / 100;
        }
        //if(_gPlayer.GetComponent<Player>()._iPlayer_HP <= 0)
        //{
        //    _eGame_State = Game_State.End;
        //}
    }
Esempio n. 12
0
    //IEnumerator CheckSendToServerState()
    //{
    //    yield return StartCoroutine(sendToServerJob.WaitFor());
    //}

    // all incoming command are handled here
    private void HandleIncomingCommand(PacketHeader packetHeader, Connection connection, VRCommand vrCommand)
    {
        ReceivedMessageEventArg e;

        switch (vrCommand.ControlMessage)
        {
        case Enums.ControlMessage.LOAD_CONFIG:
            Debug.Log("Received Tile Config from " + connection + Environment.NewLine +
                      "Length of tileConfig: " + vrCommand.TileConfig.MainScreenTiles.Count.ToString());

            VRWorld.mainTiles = vrCommand.TileConfig.MainScreenTiles;
            m_gameState       = Game_State.LoadConfig;

            e.message = "This game is load config message";
            RecievedTileConfigMessageEvent(e);
            break;

        case Enums.ControlMessage.START_NOW:
            Debug.Log("START NOW Command Received.");

            //SteamVR_Fade.Start(Color.clear, 0.5f);
            m_gameState = Game_State.Start;

            e.message = "This game is start message";
            ReceivedStartMessageEvent(e);
            break;

        case Enums.ControlMessage.END_NOW:
            Debug.Log("END NOW Command Received, message: '" + vrCommand.EndNow.Message + "'");

            s_endMessage = vrCommand.EndNow.Message;

            //SteamVR_Fade.Start(new Color(0f, 0f, 0f, 0.7f), 0);
            m_gameState = Game_State.EndGame;

            e.message = "This game is end message";
            ReceivedEndMessageEvent(e);
            break;

        case Enums.ControlMessage.SHOW_QUICK_HELP:

            Debug.Log("SHOW_QUICK_HELP Command Received.");

            m_gameState = Game_State.HelpState;

            e.message = "This Square is intend to show basic instructions.";
            ReceivedHelpMessageEvent(e);
            break;

        default:
            m_gameState = Game_State.Start;

            e.message = "This game is start message";
            ReceivedStartMessageEvent(e);
            break;
        }
    }
Esempio n. 13
0
 void Awake()
 {
     G_State            = GameObject.Find("Game_Manager").GetComponent <Game_State>();
     SetMap             = GameObject.Find("MapCreator").GetComponent <SetMapArr>();
     Min_Create         = new int[MaxType];
     Max_Create         = new int[MaxType];
     Now_Create         = new int[MaxType];
     Village_Create     = new int[7];
     Set_Village_Create = new int[7];
 }
Esempio n. 14
0
        public void leave_state()
        {
            states.Pop().cleanup();

            top_state = null;
            if (states.Count > 0)
            {
                top_state = states.Peek();
            }
        }
Esempio n. 15
0
        public void EndGame()
        {
            if (state != Game_State.GAME_OVER && OnStateChange != null)
            {
                OnStateChange.Invoke(Game_State.GAME_OVER);
                state = Game_State.GAME_OVER;

                UIManager.Instance.ShowPanel <StartPanel>("StartPanel", UILayer.System);
            }
        }
        public Collision_Handler(Game_State state, Tile_Map tile_map, Spawn_Util spawner)
        {
            this.spawner  = spawner;
            this.state    = state;
            this.tile_map = tile_map;

            reg("ships/ship11", "ships/ship11", player_player);
            reg("ships/ship11", "ships/ship12", player_player);
            reg("ships/ship11", "ships/ship13", player_player);
            reg("ships/ship11", "ships/ship14", player_player);
            reg("ships/ship12", "ships/ship12", player_player);
            reg("ships/ship12", "ships/ship13", player_player);
            reg("ships/ship12", "ships/ship14", player_player);
            reg("ships/ship13", "ships/ship13", player_player);
            reg("ships/ship13", "ships/ship14", player_player);
            reg("ships/ship14", "ships/ship14", player_player);

            reg("ships/ship11", "powerup", player_powerup);
            reg("ships/ship12", "powerup", player_powerup);
            reg("ships/ship13", "powerup", player_powerup);
            reg("ships/ship14", "powerup", player_powerup);


            reg("asteroid", "asteroid", asteroid_asteroid);
            reg("asteroid", "asteroid2", asteroid_asteroid);
            reg("asteroid2", "asteroid2", asteroid_asteroid);

            reg("beams1", "asteroid", bullet1_asteroid);
            reg("beams1", "asteroid2", bullet1_asteroid);
            reg("beams1", "ships/ship11", bullet1_player);
            reg("beams1", "ships/ship12", bullet1_player);
            reg("beams1", "ships/ship13", bullet1_player);
            reg("beams1", "ships/ship14", bullet1_player);
            reg("beams1", "soccerball", bullet1_soccerball);
            reg("beams2", "asteroid", bullet2_asteroid);
            reg("beams2", "asteroid2", bullet2_asteroid);
            reg("beams2", "ships/ship11", bullet2_player);
            reg("beams2", "ships/ship12", bullet2_player);
            reg("beams2", "ships/ship13", bullet2_player);
            reg("beams2", "ships/ship14", bullet2_player);
            reg("beams2", "soccerball", bullet2_soccerball);

            reg("wbeam", "asteroid", bullet1_asteroid);
            reg("wbeam", "asteroid2", bullet1_asteroid);
            reg("wbeam", "ships/ship11", bullet1_player);
            reg("wbeam", "ships/ship12", bullet1_player);
            reg("wbeam", "ships/ship13", bullet1_player);
            reg("wbeam", "ships/ship14", bullet1_player);
            reg("wbeam", "soccerball", bullet1_soccerball);

            reg("soccerball", "ships/ship11", soccerball_player);
            reg("soccerball", "ships/ship12", soccerball_player);
            reg("soccerball", "ships/ship13", soccerball_player);
            reg("soccerball", "ships/ship14", soccerball_player);
        }
Esempio n. 17
0
 // Use this for initialization
 void Start()
 {
     if (game_state_inst != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         game_state_inst = this;
     }
 }
Esempio n. 18
0
 // Use this for initialization
 void Start()
 {
     if (m_LogoScene != null && m_LogoCamera != null)
     {
         m_LogoScene.position = m_LogoCamera.position;
     }
     _eGame_State = Game_State.Start;
     _bStart_Game = false;
     _fGame_Time  = 60.0f;
     _fPlayer_HP  = 100.0f;
 }
Esempio n. 19
0
 public void  OutSupply()
 {
     if (preState == Game_State.Game_Enemy)
     {
         State = Game_State.Game_Player;
     }
     else
     {
         State = Game_State.Game_Enemy;
     }
 }
Esempio n. 20
0
        protected override void OnStart()
        {
            base.OnStart();

            state = Game_State.GAME_PREP;

            UIManager.Instance.ShowPanel <StartPanel>("StartPanel", UILayer.System);

            //Init managers
            PipeManager.Instance.Init();
        }
Esempio n. 21
0
        public Game_Main(VM_MainWindow view)
        {
            this.VM   = view;
            GameState = new Game_State();

            GameHistory     = new List <int[]>();
            DecisionHistory = new List <int>();

            AIInformation = new int[2];
            Context       = new SituationContext();
            AI            = new Game_PlayerAI(this, Context);
        }
Esempio n. 22
0
        public void StartGame()
        {
            PipeManager.Instance.Clear();

            UIManager.Instance.HidePanel("StartPanel");

            if (state != Game_State.GAME_PLAY && OnStateChange != null)
            {
                OnStateChange.Invoke(Game_State.GAME_PLAY);
                state = Game_State.GAME_PLAY;
            }
        }
Esempio n. 23
0
        //Konstruktor
        public VM_MainWindow()
        {
            GameInProgress = false;
            GameState      = new Game_State();

            CanExecute_Field = false;
            CanExecute_Menu  = true;
            Cmd_FieldInput   = new RelayCommand(FieldInput, parameter => CanExecute_Field);
            Cmd_Mode         = new RelayCommand(ChooseMode, parameter => CanExecute_Menu);
            Cmd_Test         = new RelayCommand(Fkt_Test);
            FieldContent     = new int[9];
            TextContent      = "Allgemeine Dinge";
        }
Esempio n. 24
0
        virtual public void InitGame()
        {
            Log.Warn(">>>> Game Scene Init");
            cur_state = Game_State.Waiting;

            lock (online_client)
            {
                online_client.Clear();
            }
            game_start_time = DateTime.Now;

            setupGameTimer();
        }
Esempio n. 25
0
        virtual public void EndRound()
        {
            Log.Warn(">>>> Game Round End");

            /* disconnect all peer */
            foreach (STServerPeer peer in online_client)
            {
                //peer.delayDisconnect();
            }

            ingame_id.Clear();

            cur_state = Game_State.Waiting;
        }
Esempio n. 26
0
    void Awake()
    {
        MaxMonster = D1_Monster_max + D2_Monster_max + D3_Monster_max + D4_Monster_max + D5_Monster_max;

        GM = GameObject.Find("Game_Manager").GetComponent <Game_State>();

        Map = GameObject.Find("MapCreator").GetComponent <SetMapArr>();

        Mon = new Monster[MaxMonster];
        for (int i = 0; i < MaxMonster; i++)
        {
            Mon[i] = new Monster();
        }
    }
Esempio n. 27
0
 void Awake()
 {
     pathFile = Application.persistentDataPath + "/data.dat";
     if (game_state == null)
     {
         game_state = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (game_state != this)
     {
         Destroy(gameObject);
     }
     loadData();
 }
Esempio n. 28
0
        virtual public void StartRound()
        {
            //if (!checkEnoughTimeForRound())
            //{
            //    Log.Warn(">>>> Not Enough Time For A Round");
            //    return;
            //}

            Log.Warn(">>>> Game Round Start");
            cur_state = Game_State.Playing;


            round_start_time = DateTime.Now;
        }
Esempio n. 29
0
    public void SetGameState(Game_State gameState)
    {
        if (gameState.Equals(Game_State.Pause))
        {
            Time.timeScale = 0f * TimeMultipler;
        }
        else if (gameState.Equals(Game_State.Running))
        {
            if (!LevelComplete && !GameManager.Lose)
            {
                Time.timeScale = 1f * TimeMultipler;
            }
        }

        GameState = gameState;
    }
Esempio n. 30
0
    public void Awake()
    {
        G_State   = GameObject.Find("Game_Manager").GetComponent <Game_State>();
        MapObj    = GameObject.Find("Field");
        CenterObj = GameObject.Find("Center");
        D1        = GameObject.Find("D1");
        D2        = GameObject.Find("D2");
        D3        = GameObject.Find("D3");
        D4        = GameObject.Find("D4");
        D5        = GameObject.Find("D5");

        // 배열을 입력한 범위로 초기화
        arr       = new int[MaxRow, MaxCol];
        MapArr    = new int[MaxRow, MaxCol];
        DangerArr = new int[MaxRow, MaxCol];
        CenterArr = new int[MaxRow, MaxCol];
    }
Esempio n. 31
0
    // Use this for initialization
    void Start()
    {
        startx = Screen.width/3;
        starty = Screen.height/6;
        credits_offset = 10;
        GameObject s = GameObject.Find("game_state");
        state = s.GetComponent<Game_State>();

        GameObject starE = Instantiate (star, new Vector3(0,0,0), new Quaternion(0,0,0,0)) as GameObject;
        Starscript starscript = starE.GetComponent<Starscript>();
        starscript.c = Color.red;
        starscript.starSize = 30;
        starscript.is_revolving = true;
        starscript.rpoint = new Vector3(20,20,0);
        starscript.rspeed = 45;
        starscript.editor_freeze = true;
    }
Esempio n. 32
0
File: Menu.cs Progetto: mbc1990/Orb
    //called before start
    void Awake()
    {
        if(GameObject.Find ("game_state") == null) {

            game_state = new GameObject();

            //allow game_state's state to persist through scene changes
            DontDestroyOnLoad(game_state);

            //allow background music object to persist
            GameObject bgm = GameObject.Find ("Background_Music");
            DontDestroyOnLoad(bgm);

            //add script to state object
            game_state.AddComponent("Game_State");
            gscpt = game_state.GetComponent<Game_State>();
            game_state.name="game_state";

            //set default ship settings here

            //levels that will be played in order
            string[] level_order = new string[12] {
                //"Levels/holes.txt",
                "Levels/bounceyballs",
                "Levels/line.txt",
                "Levels/destroy.txt",
                "Levels/circleblob.txt",
                "Levels/choices.txt",
                "Levels/1.txt",
                "Levels/level3a.txt",
                "Levels/triangle2.txt",
                "Levels/master.txt",
                "Levels/NO.txt",
                "Levels/maze.txt",
                "Levels/points.txt"
                                    };

            //state object keeps track of levels
            gscpt.level_order = level_order;

            //starting coins
            gscpt.num_coins = 2500;

        }
    }
Esempio n. 33
0
 public void InSupply()
 {
     if (Random.value < 0.7)
     {
         if (preState == Game_State.Game_Enemy)
         {
             State = Game_State.Game_Player;
         }
         else
         {
             State = Game_State.Game_Enemy;
         }
     }
     else
     {
         State = Game_State.Game_Supply;
     }
 }
Esempio n. 34
0
File: boost.cs Progetto: mbc1990/Orb
 // Use this for initialization
 void Start()
 {
     GameObject gs = GameObject.Find("game_state");
     gscpt = gs.GetComponent<Game_State>();
 }
Esempio n. 35
0
    // Use this for initialization
    void Start()
    {
        startx = Screen.width/4;
        starty = Screen.height/4;
        orb_offset = 160;
        orb_color_offset = 185;

        GameObject s = GameObject.Find("game_state");
        state = s.GetComponent<Game_State>();

        //increment level order if player has gotten enough points
        if (Manager.points >= Manager.req_points && state.cur_level < state.level_order.Length-1)
            state.cur_level++;

        //instantiate visual representations of objects next to text
        /*	GameObject starE = Instantiate (star, Camera.main.ScreenToWorldPoint(new Vector3(startx+orb_offset-30, starty+50, 30)), new Quaternion(0,0,0,0)) as GameObject;
        GameObject coin_actual = Instantiate(coin, Camera.main.ScreenToWorldPoint(new Vector3(startx+orb_offset-30, starty+120, 30)), new Quaternion (90, 0, 0, 0)) as GameObject;
        GameObject boost_actual= Instantiate(boost, Camera.main.ScreenToWorldPoint(new Vector3(startx+orb_offset-30, starty+80, 30)), new Quaternion (0, 0, 0, 0)) as GameObject;
        boost_actual.transform.localScale /= 15;
        coin_actual.transform.Rotate(90,0,0);
        coin_actual.transform.localScale /= 5;
        Starscript script = starE.GetComponent<Starscript>();
        script.c = Color.red;
        starE.transform.localScale /= 3;*/
    }
Esempio n. 36
0
    void Start()
    {
        //performance
        lastInterval = Time.realtimeSinceStartup;
        frames = 0;

        //find the gamestate object
        game_state = GameObject.Find("game_state");
        gscpt = game_state.GetComponent<Game_State>();

        //let powerups know that it's time to active
        gscpt.in_game = true;

        //instantiate learth
        l = Instantiate (learth, new Vector3 (0, -35, 0), new Quaternion (0, 0, 0, 0)) as GameObject;
         	l.renderer.material.color = Color.white;
        lt = Instantiate (white_learth_trail, l.transform.position, l.transform.rotation) as GameObject;
        lt.transform.parent = l.transform;

        //initialize timer
        start_time = Time.time;

        //load next level
        LoadLevel(gscpt.level_order[gscpt.cur_level]);

        //set lastStar to first star (because it's the last star you visited)
        lastStar = star_arr[0];
    }
Esempio n. 37
0
    void Start()
    {
        //get gamestate
        GameObject game_state = GameObject.Find("game_state");
        gscpt = game_state.GetComponent<Game_State>();

        //initialize lastPos
        lastPos = new GameObject().transform;

        lastPos.position = this.transform.position - new Vector3(Manager.speed, Manager.speed, 0f);

        r = Instantiate(radius, new Vector3 (this.transform.position.x, this.transform.position.y, 90f), new Quaternion (0, 0, 0, 0)) as GameObject;
        r.light.range = 3*transform.localScale.x;
        //parent radius to learth for destruction
        r.transform.parent = this.transform;

        random = Random.Range (0,3);
    }
Esempio n. 38
0
    void Start()
    {
        //set camera height for level editing
        Camera.main.orthographicSize = CAM_START_HEIGHT;

        //position hack, do this better (fixes camera intersecting with stars)
        Camera.main.transform.position =  new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, -128);

        //get game state
        GameObject go = GameObject.Find("game_state");
        state = go.GetComponent<Game_State>();

        //if coming from a test play
        if(state.le_test) {
            //turn off test play buttons
            state.le_test = false;

            //load temp file from the test
            LoadLevel("Levels/testingtmp");
        }
    }
Esempio n. 39
0
    // Use this for initialization
    void Start()
    {
        lightBlue = new Color(.416f, .84f, 1f);
        darkBlue = new Color(0f, .2f, .6f);
        //get state object
        game_state = GameObject.Find("game_state");
        gscpt = game_state.GetComponent<Game_State>();
        gscpt.in_game = false;

        //reset changes from previous level's powerups
        Manager.ResetConstants();

        //calculate total score
        prev_balance = gscpt.num_coins;

        mission_net = (int)((gscpt.energy_delivered/2 + 250*(gscpt.num_stars/(gscpt.time_to_complete+1)) + gscpt.aliens_killed*4 + gscpt.coins_collected*10) - (gscpt.times_died*3 + gscpt.bombs_dropped*3 + gscpt.stars_destroyed*3));
        gscpt.num_coins += mission_net;

        //if you run out of coins, game over
        if(gscpt.num_coins < 0)
            Application.Quit();
    }
Esempio n. 40
0
    void Start()
    {
        //line effect for black hole
        line = new GameObject();

        GameObject go = GameObject.Find("game_state");
        gscpt = go.GetComponent<Game_State>();

        if(bandf){
            dir = (destination - start_loc);
            //don't normalize in the editor or the wrong values will be written to the save file
            if(!editor_freeze)
                dir.Normalize();
        }

        //if the star is a black hole, instantiate cylinder to represent the black hole
        if (isBlackHole) {
            b = Instantiate(blackHole, new Vector3 (this.transform.position.x, this.transform.position.y, 800f), new Quaternion (0, 0, 0, 0)) as GameObject;
            b.transform.localScale *= starSize;
            b.transform.Rotate(90,0,0);
            center = Instantiate(BHcenter, this.transform.position, new Quaternion (0, 0, 0, 0)) as GameObject;
            center.transform.localScale *= starSize/5;
            //decrease size of star to represent the center of a black hole
            this.transform.localScale /= this.transform.localScale.x;
            //parent black hole object to star
            center.transform.parent = this.transform;
            b.transform.parent = this.transform;
            b.tag = "blackhole";
            //if powerup is selected, instantated black hole helper object behind the black hole object at the same size and scale
            if (Manager.BLACK_HOLE_HELPER || BLACK_HOLE_HELPER) {
                h = Instantiate(BHhelper, new Vector3 (this.transform.position.x, this.transform.position.y, 800f), new Quaternion (0, 0, 0, 0)) as GameObject;
                h.transform.localScale *= starSize;
                h.transform.Rotate(90,0,0);
                //parent helper object to black hole
                h.transform.parent = b.transform;
            }
        }
        //if the star is not a black hole, scale it to size specified and tag it as a star
        else
            this.transform.localScale *= starSize;
        //radius of learth's entry is the size of the star
        if (!is_source && !is_sink) {
            orbitRadius = starSize;
            //instantiate light halo at star's position the size of the orbit radius including radial error
            r = Instantiate(radius, new Vector3 (this.transform.position.x, this.transform.position.y, 90f), new Quaternion (0, 0, 0, 0)) as GameObject;
            r.light.range = 2*orbitRadius + 2*Manager.RADIAL_ERROR;
            //parent radius to star for destruction
            r.transform.parent = this.transform;
            //collider for raycasting to detect if star is tangent
            r.light.range = 2*orbitRadius + 2*Manager.RADIAL_ERROR;
            GameObject collider = Instantiate(collide, this.transform.position, new Quaternion (0, 0, 0, 0)) as GameObject;
            collider.transform.localScale *= r.light.range;//+ 3*Manager.RADIAL_ERROR;
            collider.transform.parent = this.transform;
            //do the same for light bulb effect
        //	bulb = Instantiate(bulb_instance, new Vector3 (this.transform.position.x, this.transform.position.y, 90f), new Quaternion (0, 0, 0, 0)) as GameObject;
        //	bulb.light.range = starSize;
        //	bulb.light.intensity = 8f;
            this.renderer.material.color = c;
        //	bulb.transform.parent = this.transform;
        }
        else if (is_source)
            orbitRadius = 110;
        else
            orbitRadius = 0;

        r.light.color = c;
        if (c == Manager.orange)
            r.light.intensity = 2f;
        else if (c == Manager.purple)
            r.light.intensity = 4f;
        else if (c == Manager.aqua)
            r.light.intensity = 3f;
        else
           		r.light.intensity = 3.5f;
    }