Esempio n. 1
0
 void Start()
 {
     g_game_Con_Script    = GameObject.Find("Game_Controller").GetComponent <Game_Controller>();
     g_player_sporn       = GameObject.Find("Player_Controller").GetComponent <Playercontroller>();
     g_hintScript         = GameObject.Find("Stageinformation").GetComponent <HintScript>();
     g_dice_create_Script = this.GetComponent <Dice_Create>();
 }
Esempio n. 2
0
        private void PicBox_savannah_Paint(object sender, PaintEventArgs e) //paints PicBox_savannah. Graphics only related to forms.
        {
            Graphics canvas = e.Graphics;


            for (int i = 0; i < Game_Controller.Instance().GetAreaArray().GetLength(0); i++)
            {
                for (int j = 0; j < Game_Controller.Instance().GetAreaArray().GetLength(1); j++)
                {
                    if (Game_Controller.Instance().GetAreaArray()[i, j].ContainsGrass() == true)
                    {
                        canvas.FillEllipse(Brushes.Green, new Rectangle(i * 20, j * 20, 20, 20));
                    }
                }
            }
            foreach (var item in Game_Controller.Instance().GetAnimalList())
            {
                if (item.type == animalType.lion)
                {
                    if (item.gender == gender.male)
                    {
                        canvas.FillEllipse(Brushes.Orange, new Rectangle(item.locationX * 20, item.locationY * 20, 20, 20));
                    }
                    else
                    {
                        canvas.FillEllipse(Brushes.Yellow, new Rectangle(item.locationX * 20, item.locationY * 20, 20, 20));
                    }
                }
                else
                {
                    canvas.FillEllipse(Brushes.White, new Rectangle(item.locationX * 20, item.locationY * 20, 15, 15));
                }
            }
        }
Esempio n. 3
0
    /// <summary>
    /// Deal damage to this Object.
    /// </summary>
    /// <param name="amount"> The amount of damage to take. </param>
    /// <param name="armor_penetration">The amount of armor to ignore. Set to -1 to ignore all armor.</param>
    public void Take_Damage(float amount, float armor_penetration)
    {
        Debug.Log("Object " + name + " takes " + amount + " damage!");

        /*if (aura_curr == 0)
         * {
         *  Die();
         * }
         * else
         * {
         *  if (armor_penetration != -1)
         *  {
         *      float damage_negation = armor.armor - armor_penetration;
         *      if (damage_negation < 0)
         *      {
         *          damage_negation = 0;
         *      }
         *      amount = amount - damage_negation;
         *      if (amount < 0)
         *      {
         *          amount = 0;
         *      }
         *  }
         *  aura_curr -= (int)amount;
         *  if (aura_curr < 0)
         *  {
         *      aura_curr = 0;
         *      GetComponent<SpriteRenderer>().color = Color.red;
         *  }*/
        Game_Controller.Create_Floating_Text(amount.ToString(), transform, Color.red);
        //}
    }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     agent          = GetComponent <NavMeshAgent>();
     attacks        = GetComponents <Attack>();
     anim           = GetComponent <Animator>();
     gameController = FindObjectOfType <Game_Controller>();
 }
Esempio n. 5
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "Player" || col.gameObject.tag == "Player_shell")
     {
         Game_Controller.heal();
     }
 }
    // Update is called once per frame
    void Update()
    {
        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponentInChildren <Game_Controller>();

        //dataValidation();


        Vector2 position      = new Vector2(transform.position.x, transform.position.y);
        float   dirHorizontal = Input.GetAxis("Horizontal");
        float   dirVertical   = Input.GetAxis("Vertical");

        this.dir = new Vector2(dirHorizontal * velocityHor, dirVertical * velocityVer);



        if (canMove)
        {
            body.MovePosition(position + dir);
        }

        if (body.velocity.y < 0.0f)
        {
            //body.velocity += Vector2.up * Physics2D.gravity * (fallRate - 1) * Time.deltaTime;
        }
        else
        {
            ;
        }
        {
            //body.velocity += Vector2.up * Physics2D.gravity * (lowJumRate - 1) * Time.deltaTime;
        }

        findClickQuad();
    }
Esempio n. 7
0
        private void UpdateScreen(object sender, EventArgs e)
        {
            stopWatch.Restart();

            Game_Controller.Instance().AnimalIteration();


            //updates list of animals alive
            UpdateLBOX_Animals();


            //updates list of incidents
            UpdateLBOX_Incidents();

            // Task.WaitAll(task1);

            //update graphic

            PicBox_savannah.Invalidate();

            stopWatch.Stop();
            time = stopWatch.ElapsedMilliseconds;

            txt_speedMs.Text = time.ToString();
        }
Esempio n. 8
0
 void Start()
 {
     gc           = FindObjectOfType <Game_Controller>();
     camera       = FindObjectOfType <follow_player>();
     startpos     = gameObject.transform.position;
     line_Creator = FindObjectOfType <Line_creator>();
 }
Esempio n. 9
0
	// Use this for initialization
	void Start () {
		player = GameObject.FindGameObjectWithTag ("Player").transform;
		gameScript = GameObject.Find("Game_Controller").GetComponent<Game_Controller>();
		textManagerScript = GameObject.Find("TextManager").GetComponent<textManager>();
		textTyping[1].text = textManagerScript.sendText(wordLength,wordDifficult);
		HPEnemyScript = transform.GetChild(2).GetChild(0).GetComponent<HPEnemy>();
	}
Esempio n. 10
0
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene. Commented out because of errors when restarting game
        //DontDestroyOnLoad(gameObject);
        //gameOverText.SetActive(false);
        restartButton.SetActive(false);
        incTimer = true;
        restartButton.GetComponent <CanvasGroup>().alpha = 0;
        gameOverText.CrossFadeAlpha(0.0f, 0.01f, false);
        titleText.CrossFadeAlpha(0.0f, 0.01f, false);
    }
Esempio n. 11
0
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <Game_Controller>();
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }


        GameObject playerControllerObject = GameObject.FindWithTag("Player");

        if (playerControllerObject != null)
        {
            playerController = playerControllerObject.GetComponent <PlayerController>();
        }
        if (playerController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }
    }
Esempio n. 12
0
    private void Start()
    {
        //Initial direction state
        direction = Direction.RIGHT;

        controller = FindObjectOfType <Game_Controller>();
    }
        public void AttackCallTest()
        {
            Game_Controller vTest = new Game_Controller();

            vTest.ClassChoice('W');

            vTest.AttackCall('N');
        }
Esempio n. 14
0
    void Awake()
    {
        rb             = GetComponent <Rigidbody>();
        gameController = FindObjectOfType <Game_Controller>();

        SetupCamera();
        originalCameraRotation = mainCamera.transform.rotation;
    }
Esempio n. 15
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "fly" || col.gameObject.tag == "frost" || col.gameObject.tag == "shell" || col.gameObject.tag == "heal" || col.gameObject.tag == "Player" || col.gameObject.tag == "Player_shell")
     {
         Destroy(gameObject);
     }
     Game_Controller.damage();
 }
Esempio n. 16
0
    //----------------------------------------------------------------------
    //		Start()
    // Runs on play
    //
    // Param:
    //          None
    // Return;
    //          Void
    //----------------------------------------------------------------------
    void Start()
    {
        //Cache game controller
        controller = FindObjectOfType <Game_Controller>();

        rend         = GetComponent <Renderer> ();
        rend.enabled = true;
    }
Esempio n. 17
0
 // Start is called before the first frame update
 void Start()
 {
     died           = false;
     instance       = this;
     MainSpeed      = 1000f;
     GameStarted    = false;
     Time.timeScale = 0;
 }
Esempio n. 18
0
 void GameManeger()
 {
     if (current == null)
     {
         //Player_Controller, making only one gameobject
         current = this;
     }
 }
Esempio n. 19
0
 void OnEnable()
 {
     //get the Game_Controller script
     if (gameController == null)
     {
         gameController = gameObject.GetComponent <Game_Controller> ();
     }
 }
Esempio n. 20
0
 // Start is called before the first frame update
 void Start()
 {
     Shotgun.SetActive(false);
     UMP40.SetActive(false);
     _Player         = GameObject.Find("Player");
     _GameController = GameObject.Find("Game_Controller");
     grenadeScript   = _GameController.GetComponent <Game_Controller>();
 }
Esempio n. 21
0
 void Start()
 {
     g_game_Con_Script = GameObject.Find("Game_Controller").GetComponent <Game_Controller>();
     g_json_Script     = GameObject.Find("Game_Controller").GetComponent <Input_Data>();
     //ステージの配列の最大値を取得
     (g_max_Ver, g_max_Side, g_max_High) = g_json_Script.Get_Array_Max();
     //初期化
     Reset_Array();
 }
Esempio n. 22
0
 void Start()
 {
     g_json_Script      = GameObject.Find("Game_Controller").GetComponent <Input_Data>();
     g_game_Con_Script  = GameObject.Find("Game_Controller").GetComponent <Game_Controller>();
     g_se_source_Script = GameObject.Find("SEList").GetComponent <Se_Source>();
     g_particle_Script  = GameObject.Find("Particle_Source").GetComponent <Particle_Source>();
     //縦横高さの最大値をjsonで決めた数へ変更する
     (g_max_Ver, g_max_Side, g_max_High) = g_json_Script.Get_Array_Max();
 }
Esempio n. 23
0
 void Start()
 {
     g_game_Con_Script  = GameObject.Find("Game_Controller").GetComponent <Game_Controller>();
     g_check_Script     = this.GetComponent <Move_Check>();
     g_dice_fall_Script = this.GetComponent <Dice_Fall>();
     g_undo_Script      = GameObject.Find("Game_Controller").GetComponent <Undo_Script>();
     //配列を生成
     g_work_Objs_Array = new GameObject[g_array_max, g_array_max, g_array_max];
 }
Esempio n. 24
0
    private void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <Game_Controller>();
        }
    }
Esempio n. 25
0
 private void Start()
 {
     g_game_con_Script    = GameObject.Find("Game_Controller").GetComponent <Game_Controller>();
     g_player_con_Script  = GameObject.Find("Player_Controller").GetComponent <Playercontroller>();
     g_direction_Script   = GameObject.Find("Player_Controller").GetComponent <Player_Direction>();
     g_dice_create_Script = GameObject.Find("Stage_Pool").GetComponent <Dice_Create>();
     g_trouble_Script     = GameObject.Find("TroubleObj").GetComponent <TroubleScr>();
     Array_Reset();
 }
Esempio n. 26
0
 public Battle(char p)
 {
     GameController = new Game_Controller();
     GameController.ClassChoice(p);
     InitializeComponent();
     lblNPCHp.Content     = GameController.enemy.Hp.ToString();
     lblPlayerHp.Content  = GameController.Player.Hp.ToString();
     lblPlayerDam.Content = GameController.Player.BaseDamage.ToString();
 }
Esempio n. 27
0
 void Awake()
 {
     if (controller == null) {
         DontDestroyOnLoad (gameObject);
         controller = this;
     } else if (controller != this) {
         Destroy(gameObject);
     }
 }
Esempio n. 28
0
    //void OnGUI()
    //{
    //	GameObject box = GUI.Box (new Rect (0, 0, 200, 50), "Life: " + Game_Controller.hp + "/5");

    //}

    public void OnCollisionEnter2D(Collision2D shit)
    {
        if (shit.gameObject.tag == "frost")
        {
            runSpeed  -= 8f;
            jumpForce -= 2.5f;
            Game_Controller.press();
            shit.gameObject.tag = "pad";
            StartCoroutine(Frost());
        }
        if (shit.gameObject.tag == "fly")
        {
            rb.gravityScale     = 2.8f;
            shit.gameObject.tag = "pad";
            StartCoroutine(Fly());
        }
        if (shit.gameObject.tag == "heal")
        {
            Game_Controller.heal();
            shit.gameObject.tag = "pad";
        }
        if (shit.gameObject.tag == "shell")
        {
            gameObject.tag      = "Player_shell";
            shit.gameObject.tag = "pad";
            StartCoroutine(Shell());
        }
        if (shit.gameObject.tag == "Finish")
        {
            if (Game_Controller.tile >= 12)
            {
                Menu.SetActive(true);
                Fale.SetActive(true);
                Victory.SetActive(false);
                Fale_run.SetActive(true);
                Return.SetActive(false);
                Exit.SetActive(true);
            }
            else if (Game_Controller.tile >= 20)
            {
                Menu.SetActive(false);
                Fale.SetActive(false);
                Victory.SetActive(false);
                Fale_run.SetActive(true);
                Return.SetActive(false);
                Exit.SetActive(true);
            }
            else
            {
                Menu.SetActive(true);
                Fale.SetActive(false);
                Fale_run.SetActive(false);
                Victory.SetActive(true);
                Return.SetActive(false);
            }
        }
    }
Esempio n. 29
0
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");

        GC = gameControllerObject.GetComponent <Game_Controller> ();

        GetComponent <Rigidbody2D>().velocity = transform.up * speed;
        Destroy(this.gameObject, 1.0F);
    }
Esempio n. 30
0
    void OnEnable()
    {
        if (gameController == null)
        {
            gameController = GameObject.Find("Game Controller").GetComponent <Game_Controller> ();
        }

        Invoke("SpawnEnemy", 0.5f);
    }
Esempio n. 31
0
    public void SetupPlayer()
    {
        gameController = FindObjectOfType <Game_Controller>();
        GetComponent <Camera_Follow>().playerNum = this.playerNum;
        //Adjust Camera to fit players on screen
        GetComponent <Camera_Follow>().SetupCamera();

        ColorPlayer();
    }
Esempio n. 32
0
    void OnEnable()
    {
        if (gameController == null)
        {
            gameController = GameObject.Find("Game Controller").GetComponent <Game_Controller> ();
        }

        StartCoroutine("GetTarget");
        targetAquired = false;
    }
 void Awake()
 {
     float_counter_1 = 0f;
     float_counter_2 = 0f;
     Strategy.Activities.counter = this;
     Strategy.Action.counter = this;
     Line.counter = this;
     contr = GameObject.FindWithTag (Tags.gameController).GetComponent < Game_Controller> ();
     contr.SCRIPTS.counter = this;
 }
Esempio n. 34
0
	// Use this for initialization
	void Start () {
		QnTPn.Close ();
		QnTPnC.Close ();
		gameScript = GameObject.Find("Game_Controller").GetComponent<Game_Controller>();
		textManagerScript = GameObject.Find("TextManager").GetComponent<textManager>();
		HPEnemyScript = transform.GetChild(2).GetChild(0).GetComponent<HPEnemy>();
		textTyping [0].text = setOfQuiz [0];
		textTyping [2].text = setOfQuiz [2];
		textTyping [4].text = setOfQuiz [3];
		textTyping [6].text = setOfQuiz [1];
	}
Esempio n. 35
0
    // Use this for initialization
    void Start()
    {
        GameObject objGameController = GameObject.FindWithTag("GameController");

        if (objGameController != null)
        {
            gamecontroller = objGameController.GetComponent<Game_Controller>();
        }

        if (gamecontroller == null)
        {
            Debug.Log("Não encontrou nenhum Script 'Game_Controller'.");
        }
    }
Esempio n. 36
0
    // Use this for initialization
    protected override void Start()
    {
        //Debug.Log("Start");

        base.Start();

        m_DynamicObjects = new List<DynamicObject>();
        m_CanJump = false;

        m_CurrentlyTouching = new List<GameObject>();

        TheGame = FindObjectOfType<Game_Controller>();
        if (TheGame == null)
            Debug.Log("You forgot to add a Game Controller...");
    }
Esempio n. 37
0
	// Use this for initialization
	void Start () {
		PRG_Controller.Close ();
		PRG_STSC.Close ();
		gameScript = GameObject.Find("Game_Controller").GetComponent<Game_Controller>();
		textManagerScript = GameObject.Find("TextManager").GetComponent<textManager>();
		HPEnemyScript = transform.GetChild(2).GetChild(0).GetComponent<HPEnemy>();
		textTyping [1].text = paragraph [0];
		sentence1 = textTyping [1].text;
		textTyping [3].text = paragraph [1];
		sentence2 = textTyping [1].text;
		textTyping [5].text = paragraph [2];
		sentence3 = textTyping [1].text;
		textTyping [7].text = paragraph [3];
		sentence4 = textTyping [1].text;
	}
Esempio n. 38
0
    // Use this for initialization
    void Start()
    {
        GameObject objGameController = GameObject.FindWithTag("GameController");

        if (objGameController != null)
        {
            gamecontroller = objGameController.GetComponent<Game_Controller>();
        }

        if (gamecontroller == null)
        {
            Debug.Log("Não encontrou nenhum Script 'Game_Controller'.");
        }

        transform.Rotate(new Vector3(0, Random.Range(0.0f, 360.0f), 0), Space.World);
    }
 void Awake()
 {
     _debugText = GameObject.Find ( "Debug_Text" );
     gameController = GameObject.FindWithTag( "GameController" ).GetComponent<Game_Controller>();
 }
 void Awake()
 {
     contr = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<Game_Controller> ();
     Activities.strategy = this;
     Line.strategy = this;
     Action.strategy = this;
     Vector.strategy = this;
 }
 void Start()
 {
     Player = FindObjectOfType<Human>().gameObject;
     TheGame = FindObjectOfType<Game_Controller>();
 }
Esempio n. 42
0
 // Use this for initialization
 void Start()
 {
     //Screen.SetResolution(resolution_x, resolution_y, true);
     controller = Game_Controller.controller;
 }
Esempio n. 43
0
 // Use this for initialization
 void Start()
 {
     controller = Game_Controller.controller;
 }
Esempio n. 44
0
	// Use this for initialization
	void Start () {
		gameScript = GameObject.Find("Game_Controller").GetComponent<Game_Controller>();
	}
Esempio n. 45
0
    //choice จะผูกกับ warppoint และ choice2 จะถูกผูกกับ warppoint2
    //Choice ... แล้วก็คำพูดของตัวละครเราล่ะ ... ต้องมี Image ด้วย

    //ประเด็นคือ เราจะทำยังไง ให้มันโผล่มาได้เรื่อยๆนะ -..-
    //BUTTON

	// Use this for initialization
	void Start () {

        gameControllerScript = GameObject.Find("Game_Controller").GetComponent<Game_Controller>();
        exclaim = transform.GetChild(0).gameObject;
	}
Esempio n. 46
0
 // Use this for initialization
 void Start()
 {
     controller = Game_Controller.controller;
     //container = transform.FindChild("Action Menu").GetComponent<RectTransform>();
     //resetActions();
     isOpen = false;
 }
    void Awake()
    {
        //Seed the random
        Random.seed = (int)System.DateTime.Now.Ticks;

        //Set the static reference to this object
        gameController = this;

        //Since lost is static, it needs its value reset every game
        lost = false;

        //Make sure the game over ui isn't showing
        gameOverCanvas.SetActive(false);
    }
Esempio n. 48
0
    public Scenario(string filename)
    {
        controller = Game_Controller.controller;
        scenario_file = filename;
        //Initialize Lists
        rewards = new List<string>();
        bonus_rewards = new List<string>();
        List<int> unlocks_scenarios = new List<int>();
        List<int> unlocks_scenarios_on_loss = new List<int>();
        List<int> unlocks_scenarios_on_win = new List<int>();
        List<int> unlocks_scenarios_on_bonus = new List<int>();
        //Read in the file
        string[] lines = System.IO.File.ReadAllLines(scenario_file);
        string line = "";
        string[] elements = new string[2];
        //30 is the default grid size;
        int grid_width=30;
        int grid_length=30;
        int[,] tile_sprite_ids = new int[grid_width, grid_length];
        int[,] object_sprite_ids = new int[grid_width, grid_length];
        int[,] character_sprite_ids = new int[grid_width, grid_length];
        //Read through the file line by line, looking for specific headings
        for (int i = 0; i < lines.Length; i++)
        {
            line = lines[i];
            switch (line)
            {
                //ID of the scenario
                case "[ID]":
                    scenario_name = lines[i + 1];
                    i += 2;
                    break;
                //What Sector the scenario can be found in
                case "[Sector]":
                    scenario_sector = lines[i + 1];
                    i += 2;
                    break;
                //Name of the Scenario
                case "[Name]":
                    scenario_name = lines[i + 1];
                    i+=2;
                    break;
                //Description for the Scenario
                case "[Description]":
                    description = lines[i + 1];
                    i += 2;
                    break;
                //Objective for the scenario (see Objectives enum for list of possible objectives.)
                case "[Objective]":
                    foreach (Objectives obj in System.Enum.GetValues(typeof(Objectives)))
                    {
                        if(obj.ToString() == lines[i + 1])
                        {
                            objective = obj;
                        }
                    }
                    i += 2;
                    break;
                //Reward for winning the scenario
                case "[Reward]":
                    for(int j = i+1; j<lines.Length; j++)
                    {
                        if (lines[j] != "")
                        {
                            rewards.Add(lines[j]);
                        }
                        else
                        {
                            i = j;
                            j = lines.Length;
                        }
                    }
                    break;
                //Bonus objective for the scenario
                case "[Bonus Objective]":
                    bonus_objective = lines[i + 1];
                    i += 2;
                    break;
                //Reward for completing the Bonus Objective
                case "[Bonus Reward]":
                    for (int j = i + 1; j < lines.Length; j++)
                    {
                        if (lines[j] != "")
                        {
                            bonus_rewards.Add(lines[j]);
                        }
                        else
                        {
                            i = j;
                            j = lines.Length;
                        }
                    }
                    break;
                //Scenario IDs that will be unlocked regardless of wether or not the Objective is met
                case "[Unlocks]":
                    elements = lines[i + 1].Split(';');
                    int id = scenario_id;
                    foreach (string s in elements)
                    {
                        if (int.TryParse(s, out id))
                        {
                            unlocks_scenarios.Add(id);
                        }
                    }
                    i += 2;
                    break;
                //Scenario IDs that will be unlocked if the Objective is not met
                case "[Unlocks on Loss]":
                    elements = lines[i + 1].Split(';');
                    id = scenario_id;
                    foreach (string s in elements)
                    {
                        if (int.TryParse(s, out id))
                        {
                            unlocks_scenarios_on_loss.Add(id);
                        }
                    }
                    i += 2;
                    break;
                //Scenario IDs that will be unlocked if the Objective is met
                case "[Unlocks on Win]":
                    elements = lines[i + 1].Split(';');
                    id = scenario_id;
                    foreach (string s in elements)
                    {
                        if (int.TryParse(s, out id))
                        {
                            unlocks_scenarios_on_win.Add(id);
                        }
                    }
                    i += 2;
                    break;
                //Scenario IDs that will be unlocked if the Bonus Objective is met
                case "[Unlocks on Bonus]":
                    elements = lines[i + 1].Split(';');
                    id = scenario_id;
                    foreach (string s in elements)
                    {
                        if (int.TryParse(s, out id))
                        {
                            unlocks_scenarios_on_bonus.Add(id);
                        }
                    }
                    i += 2;
                    break;
                //Size of the tile grid map
                case "[Grid Size]":
                    int width = 30;
                    int length = 30;
                    if (int.TryParse(lines[i + 1].Split(';')[0], out width))
                    {
                        grid_width = width;
                    }
                    if (int.TryParse(lines[i + 1].Split(';')[1], out length))
                    {
                        grid_length = length;
                    }
                    i += 2;
                    break;
                case "[Tile Map]":
                    tile_sprite_ids = new int[grid_width, grid_length];
                    for( int k = i+1; k<i+grid_length+1; k++)
                    {
                        string[] entries = lines[k].Split(';');
                        for (int l = 0; l<grid_width; l++)
                        {
                            int sprite;
                            if (int.TryParse(entries[l], out sprite))
                            {
                                tile_sprite_ids[k-i-1, l] = sprite;
                            }
                        }
                    }
                    break;
                case "[Object Map]":
                    object_sprite_ids = new int[grid_width, grid_length];
                    for (int k = i + 1; k < i + grid_length+1; k++)
                    {
                        string[] entries = lines[k].Split(';');
                        for (int l = 0; l < grid_width; l++)
                        {
                            int sprite;
                            if (int.TryParse(entries[l], out sprite))
                            {
                                object_sprite_ids[k-i-1, l] = sprite;
                            }
                        }
                    }
                    break;
                case "[Character Map]":
                    character_sprite_ids = new int[grid_width, grid_length];
                    for (int k = i + 1; k < i + grid_length + 1; k++)
                    {
                        string[] entries = lines[k].Split(';');
                        for (int l = 0; l < grid_width; l++)
                        {
                            int sprite;
                            if (int.TryParse(entries[l], out sprite))
                            {
                                character_sprite_ids[k - i - 1, l] = sprite;
                            }
                        }
                    }
                    break;
                //Default in case none of the above cases are met
                default:
                    break;
            }
            //Resume new scenario creation
            tile_grid = new Tile_Grid(grid_width, grid_length, tile_sprite_ids, object_sprite_ids, character_sprite_ids);
            tile_grid.tile_prefab.GetComponent<SpriteRenderer>().color = new Color(255f, 255f, 255f, 1f);

            curr_round = 0;
            curr_character_num = 0;
            turn_index = 0;
            turn_order = new List<GameObject>();
            reachable_tiles = new List<Transform>();
            reachable_tile_objects = new List<GameObject>();
        }
    }
 // Use this for initialization
 void Awake()
 {
     current_contr = this;
     //Player.setBot(true);
     //currentTeam = PlayerMovement.Team.White;
     SCRIPTS.main_camera.setRotation_by_Mouse (false);
     canvas = SCRIPTS.canvas.GetComponent<Canvas> ()as Canvas;
     BlackTeam = new List<PlayerMovement> ();
     WhiteTeam = new List<PlayerMovement> ();
     OPTIONS.Black_transform_gc=new Transform_GC[OPTIONS.size_of_team];
     OPTIONS.White_transform_gc=new Transform_GC[OPTIONS.size_of_team];
     Players_Action_WB = new List<PlayerMovement> ();
     int a;
     for(int i=0;i<OPTIONS.size_of_team;i++)
     {
         a=i+1;
         if((i+1)%2==1)
         {
             a=-a/2*OPTIONS.lenght;
             if(!OPTIONS.oneTeamInField||currentTeam==PlayerMovement.Team.Black)
             {
                 OPTIONS.Black_transform_gc[i].position=new Vector3(-10,0 ,a);
                 OPTIONS.Black_transform_gc[i].rotation=new Vector3(  0,90,0);
             }
             if(!OPTIONS.oneTeamInField||currentTeam==PlayerMovement.Team.White)
             {
                 OPTIONS.White_transform_gc[i].position=new Vector3(10,0  ,a);
                 OPTIONS.White_transform_gc[i].rotation=new Vector3( 0,-90,0);
             }
         }
         else
         {
             a=a/2*OPTIONS.lenght;
             if(!OPTIONS.oneTeamInField||currentTeam==PlayerMovement.Team.Black)
             {
                 OPTIONS.Black_transform_gc[i].position=new Vector3(-10, 0,a);
                 OPTIONS.Black_transform_gc[i].rotation=new Vector3(  0,90,0);
             }
             if(!OPTIONS.oneTeamInField||currentTeam==PlayerMovement.Team.White)
             {
                 OPTIONS.White_transform_gc[i].position=new Vector3(10,  0,a);
                 OPTIONS.White_transform_gc[i].rotation=new Vector3( 0,-90,0);
             }
         }
         if(!OPTIONS.oneTeamInField||currentTeam==PlayerMovement.Team.Black)
             BlackTeam.Add(Add(PlayerMovement.Team.Black,OPTIONS.Black_transform_gc[i]));
         if(!OPTIONS.oneTeamInField||currentTeam==PlayerMovement.Team.White)
             WhiteTeam.Add(Add(PlayerMovement.Team.White,OPTIONS.White_transform_gc[i]));
     }
     PlayerMovement.strategyCamera = OBJECTS.Strategy_Camera;
     Line.contr = this;
     Vector.contr = this;
     PlayerMovement.contr = this;
     Strategy.canvas = canvas;
     SCRIPTS.strategy.AwakeStaticDate ();
     SCRIPTS.strategy.Ini ();
 }
Esempio n. 50
0
    // Use this for initialization
    void Start()
    {
        launched = false;
        // Gets this GameObjects Rigidbody
        rb = GetComponent<Rigidbody> ();
        if (Game_Controller.Whiteness) {
            GetComponent<Renderer>().material.mainTexture = whiteball;
        } else if (!(Game_Controller.Whiteness)) {
            GetComponent<Renderer>().material.mainTexture = blackball;
        }

        GameObject gameControllerObject = GameObject.FindWithTag ("GameController");
        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <Game_Controller>();
        }
    }
	void Start(){
        levelUp = GameObject.Find("levelUp");
        inventoryFull = GameObject.Find("inventoryFull");
        fireNoti = GameObject.Find("fireNoti");
        iceNoti = GameObject.Find("iceNoti");
        slowNoti = GameObject.Find("slowNoti");
        knockNoti = GameObject.Find("knockNoti");
        healNoti = GameObject.Find("healNoti");
        trapNoti = GameObject.Find("trapNoti");
        sameLetterNoti = GameObject.Find("sameLetterNoti");
        sameWordNoti = GameObject.Find("sameWordNoti");
        oneLetterNoti = GameObject.Find("oneLetterNoti");

        levelUpScript = levelUp.GetComponent<NotiController>();
        inventoryFullScript = inventoryFull.GetComponent<NotiController>();
        fireNotiScript = fireNoti.GetComponent<NotiController>();
        iceNotiScript = iceNoti.GetComponent<NotiController>();
        slowNotiScript = slowNoti.GetComponent<NotiController>();
        knockNotiScript = knockNoti.GetComponent<NotiController>();
        healNotiScript = healNoti.GetComponent<NotiController>();
        trapNotiScript = trapNoti.GetComponent<NotiController>();
        sameLetterNotiScript = sameLetterNoti.GetComponent<NotiController>();
        sameWordNotiScript = sameWordNoti.GetComponent<NotiController>();
        oneLetterNotiScript = oneLetterNoti.GetComponent<NotiController>();

        gameController = GameObject.Find("Game_Controller").GetComponent<Game_Controller>();
        noData = GameObject.Find("Nodata");
        OptionPanel = GameObject.Find("OptionPanel");
        CreditPanel = GameObject.Find("CreditPanel");
        DisclaimerPanel = GameObject.Find("DisclaimerPanel");
        swordPanel = GameObject.Find("SwordPanel").GetComponent<SwordPanel>();
        bowPanel = GameObject.Find("BowPanel").GetComponent<BowPanel>();
        clothPanel = GameObject.Find("ClothPanel").GetComponent<ClothPanel>();
        bootPanel = GameObject.Find("BootPanel").GetComponent<BootPanel>();
        inv = GameObject.Find("Inventory").GetComponent<Inventory>();
        TypingProgressDetail = GameObject.Find("TypingProgressDetail").GetComponent<Text>();
        currentGameDifficulty = GameObject.Find("currentGameDifficulty").GetComponent<Text>();
        characterLevel = GameObject.Find("CharacterLevel").GetComponent<Text>();
        characterWorld = GameObject.Find("CharacterWorld").GetComponent<Text>();
        characterStory = GameObject.Find("CharacterStory").GetComponent<Text>();
        wordDifficultyChar = GameObject.Find("WordDifficultyChar").GetComponent<Text>();
        gameDifficultyChar = GameObject.Find("GameDifficultyChar").GetComponent<Text>();
        skillFire = GameObject.Find("FireSkillPanel").GetComponent<Skill_Fire>();
        skillIce = GameObject.Find("IceSkillPanel").GetComponent<Skill_Ice>();
        skillSlow = GameObject.Find("SlowSkillPanel").GetComponent<Skill_Slow>();
        skillHeal = GameObject.Find("HealSkillPanel").GetComponent<Skill_Heal>();
        skillKnock = GameObject.Find("KnockSkillPanel").GetComponent<Skill_Knock>();
        skillTrap = GameObject.Find("TrapSkillPanel").GetComponent<Skill_Trap>();

        startPicture = GameObject.Find("StartPicture");
        clearButton = GameObject.Find("ClearButton");
        playerStatus = GameObject.Find("PlayerStatus");
        weaponPanel = GameObject.Find("WeaponPanel");
        skillPanel = GameObject.Find("SkillUse");
        typingProgressButton = GameObject.Find("TypingProgressButton");
        skillButton = GameObject.Find("SkillButton");
        inventoryButton = GameObject.Find("InventoryButton");
        optionButton = GameObject.Find("Option");
        objectivePanel = GameObject.Find("QuestDetail");

        newGameButton = GameObject.Find("Start Game");
        loadGameButton = GameObject.Find("Load Game");
        exitGameButton = GameObject.Find("Exit");

        ClearGameScene = GameObject.Find("ClearGameScene");
        LoadSaveCloseButton = GameObject.Find("CloseOfLoadSave");
        a = GameObject.Find("TextManager").GetComponent<textManager>();
        typingProgressMenu = GameObject.Find("TypingProgressPanel");
        mainMenu = GameObject.Find("LoadSavePanel");
        changeDiffMenu = GameObject.Find("ChangeDifficultyMenu");
        LoadScene = GameObject.Find("LoadScene");
        loadSceneScript = LoadScene.transform.GetChild(0).GetComponent<Text>().GetComponent<LoadText>();
        //checkInLoadText = LoadScene.transform.GetChild(0).GetComponent<Text>().GetComponent<LoadText>().check;
        SkillToolTip = GameObject.Find("SkillToolTip");
        SkillPanel = GameObject.Find("SkillPanel");
        detail = GameObject.Find("Detail").GetComponent<Text>();
        conversation = GameObject.Find("Conversation");
        blackScene = GameObject.Find("BlackScene");
        displayGameObj = GameObject.Find("Character");
        NPCnameGameObj = GameObject.Find("NPCTitle");
        talkGameObj = GameObject.Find("Talk");
        continueButton = GameObject.Find("Continue");
        choice1 = GameObject.Find("Choice1");
        choice2 = GameObject.Find("Choice2");

        display = displayGameObj.GetComponent<Image>();
        NPCname = NPCnameGameObj.transform.GetChild(0).GetComponent<Text>();
        talk = talkGameObj.GetComponent<Text>();
        choice1Text = choice1.transform.GetChild(0).GetComponent<Text>();
        choice2Text = choice2.transform.GetChild(0).GetComponent<Text>();

        levelUp.SetActive(false);
        inventoryFull.SetActive(false);
        fireNoti.SetActive(false);
        iceNoti.SetActive(false);
        slowNoti.SetActive(false);
        knockNoti.SetActive(false);
        healNoti.SetActive(false);
        trapNoti.SetActive(false);
        sameLetterNoti.SetActive(false);
        sameWordNoti.SetActive(false);
        oneLetterNoti.SetActive(false);

        noData.SetActive(false);
        OptionPanel.SetActive(false);
        DisclaimerPanel.SetActive(false);
        CreditPanel.SetActive(false);
        playerStatus.SetActive(false);
        weaponPanel.SetActive(false);
        skillPanel.SetActive(false);
        typingProgressButton.SetActive(false);
        skillButton.SetActive(false);
        inventoryButton.SetActive(false);
        objectivePanel.SetActive(false);

        clearButton.SetActive(false);
        ClearGameScene.SetActive(false);
        typingProgressMenu.SetActive(false);
        changeDiffMenu.SetActive(false);
        mainMenu.SetActive(false);
        blackScene.SetActive(false);
        displayGameObj.SetActive(false);
        NPCnameGameObj.SetActive(false);
        talkGameObj.SetActive(false);
        continueButton.SetActive(false);
        choice1.SetActive(false);
        choice2.SetActive(false);
        conversation.SetActive(false);
        SkillPanel.SetActive(false);
        SkillToolTip.SetActive(false);
        LoadScene.SetActive(false);

		playerInThisMap = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
		GameObject[] enemySpawn = GameObject.FindGameObjectsWithTag("Enemy");
		GameObject[] treasureInMap = GameObject.FindGameObjectsWithTag("Treasure");

		foreach(GameObject enemy in enemySpawn){
			enemyInThisMap.Add(enemy.GetComponent<Enemy>());
		}

		foreach(GameObject enemy in enemySpawn){
			enemy.SetActive(false);
		}

        playerInThisMap.gameObject.SetActive(false);

		foreach (GameObject chest in treasureInMap) {

			treasureMinigame.Add (chest.GetComponent<Treasure>());
		}
       
    }
 void Awake()
 {
     instance = this;
 }
 void Start()
 {
     contr = Game_Controller.current_contr;
     counter = contr.SCRIPTS.counter;
     contr.EndDown += EndDown;
 }