//----------------------------------

        protected void SplitOrder()
        {
            if (Input.GetKeyDown(KeyCode.S))
            {
                if (this.selectedObjects.Count > 0)
                {
                    bool enemyCheck = false;
                    foreach (GameObject obj in this.selectedObjects)
                    {
                        CommonUnit unit = obj.GetComponent <CommonUnit>();
                        if (unit.isEnemy)
                        {
                            enemyCheck = true;
                        }
                    }
                    if (!enemyCheck)
                    {
                        foreach (GameObject owner in this.selectedObjects)
                        {
                            CommonUnit unit = owner.GetComponent <CommonUnit>();
                            if (unit.level == 1)
                            {
                                GameObject duplicate = GameObject.Instantiate <GameObject>(this.commonUnitPrefab);
                                duplicate.transform.position = owner.transform.position;
                                unit.SetDeselect();
                                unit.DisableSelection();
                                unit.SetSplitting();
                                unit = duplicate.GetComponent <CommonUnit>();
                                unit.SetDeselect();
                                unit.DisableSelection();
                                unit.SetSplitting();
                                unit.initialColor = Color.white;
                                this.unitManager.getAllObjects().Add(duplicate);
                                this.splitManager.splitGroups.Add(new SplitGroup(owner, duplicate));
                            }
                        }
                    }
                    this.selectedObjects.Clear();
                }
            }
        }
        //----------------------------------

        protected void MergeOrder()
        {
            if (Input.GetKeyDown(KeyCode.D))
            {
                if (this.selectedObjects.Count > 0)
                {
                    bool enemyCheck = false;
                    foreach (GameObject obj in this.selectedObjects)
                    {
                        CommonUnit unit = obj.GetComponent <CommonUnit>();
                        if (unit.isEnemy)
                        {
                            enemyCheck = true;
                        }
                    }
                    if (!enemyCheck)
                    {
                        List <GameObject> pairedUnitsList = new List <GameObject>();
                        for (int i = 0; i < this.selectedObjects.Count - 1; i++)
                        {
                            if (pairedUnitsList.Contains(this.selectedObjects[i]))
                            {
                                continue;
                            }
                            CommonUnit unpairedUnit = this.selectedObjects[i].GetComponent <CommonUnit>();
                            for (int j = i + 1; j < this.selectedObjects.Count; j++)
                            {
                                if (pairedUnitsList.Contains(this.selectedObjects[j]))
                                {
                                    continue;
                                }
                                CommonUnit undeterminedUnit = this.selectedObjects[j].GetComponent <CommonUnit>();
                                if (unpairedUnit.level == undeterminedUnit.level)
                                {
                                    unpairedUnit.DisableSelection();
                                    unpairedUnit.SetDeselect();
                                    unpairedUnit.SetMerging();
                                    undeterminedUnit.DisableSelection();
                                    undeterminedUnit.SetDeselect();
                                    undeterminedUnit.SetMerging();
                                    this.mergeManager.mergeGroups.Add(new MergeGroup(this.selectedObjects[i], this.selectedObjects[j]));
                                    pairedUnitsList.Add(this.selectedObjects[i]);
                                    pairedUnitsList.Add(this.selectedObjects[j]);
                                    break;
                                }
                            }
                        }
                    }
                    this.selectedObjects.Clear();
                }
            }
        }