예제 #1
0
    // Changes the selected object in the level
    public void ChangeSelection(GameObject newSelection)
    {
        if (newSelection == null)
        {
            return;
        }

        if (currentObject != null)
        {
            DeselectObject();
        }

        currentObject = newSelection;

        // Activates the inspector
        gameObject.transform.GetChild(0).gameObject.SetActive(true);

        // Highlights the object with the Outline class
        currentOutline = HighlightObject(currentObject);

        ComponentManager.current.GenerateComponentValueList(currentObject);
        ChangeName(newSelection.name);

        transformGizmo.SetTransform(currentObject.transform);
    }
예제 #2
0
    void Start()
    {
        //Selectable[] selectabless = FindObjectsOfType(typeof(Selectable)) as Selectable[];
        //foreach(Selectable str in selectabless)
        //{
        //	Debug.Log(str);
        //}
        name = gameObject.name;
        //GameObject go = GameObject.Find("Canvas");
        //if (!go)
        //return;

        //panel = go.GetComponent<Image>();

        /*string filePath = Application.streamingAssetsPath + "/Provinces/";
         *      string[] files = System.IO.Directory.GetFiles(filePath);
         * for (int i = 0; i < files.Length; i++){
         *  provinceNames.add(Province.)
         * }*/
        //Sets a var "g" to the current game object
        GameObject g = gameObject;

        //Debug.Log(g);
        //Gets bool from script: Outline.cs
        booltest = g.GetComponent <cakeslice.Outline>();
        booltest.eraseRenderer = true;
        // Debug.Log(booltest);
        //Debug.Log("This may work");
    }
예제 #3
0
 private void OnEnable()
 {
     _signalPlaneObject.SetActive(false);
     _currentHP       = _maxHP;
     _outline         = gameObject.GetComponentInChildren <cakeslice.Outline>(true);
     _outline.enabled = false;
     _signals         = 0;
 }
예제 #4
0
    private void Start()
    {
        var go = GameObject.FindGameObjectWithTag("GameController");

        undoRedo    = go.GetComponent <UndoRedoController>();
        btnsScaling = go.GetComponent <BtnsScalingOb>();
        menuObjetos = GameObject.FindGameObjectWithTag("MenuObjetos");
        outLine     = this.GetComponent <cakeslice.Outline>();
    }
예제 #5
0
    protected override void Awake()
    {
        base.Awake();

        _objectManager   = ObjetManager.Instance;
        _objectGenerator = ObjectGenerator.Instance;
        _zoneManager     = ZoneManager.Instance;
        _camera          = Camera.main;
        _mesh            = GetComponentInChildren <MeshFilter>().mesh;
        _meshCollider    = GetComponentInChildren <MeshCollider>();
        _meshFilter      = GetComponentInChildren <MeshFilter>();

        _objectManager.AddObject(this);
        _coll     = GetComponent <Collider>();
        _renderer = GetComponent <Renderer>();
        if (_coll == null)
        {
            foreach (Transform child in transform)
            {
                _coll     = child.GetComponent <Collider>();
                _renderer = child.GetComponent <Renderer>();
                if (_coll != null)
                {
                    continue;
                }
            }
        }
        _controls = Controls.Instance;
        _outline  = GetComponent <cakeslice.Outline>();
        if (_outline == null)
        {
            if (GetComponent <Collider>() != null)
            {
                _outline = gameObject.AddComponent <cakeslice.Outline>();
            }
            else
            {
                foreach (Transform child in transform)
                {
                    if (child.gameObject.GetComponent <Renderer>() != null && child.gameObject.GetComponent <cakeslice.Outline>() == null)
                    {
                        _outline = child.gameObject.AddComponent <cakeslice.Outline>();
                    }
                    else if (child.gameObject.GetComponent <cakeslice.Outline>() != null)
                    {
                        _outline = child.gameObject.GetComponent <cakeslice.Outline>();
                    }
                }
            }
        }
        if (_outline == null)
        {
            gameObject.AddComponent <BoxCollider>();
            _outline = gameObject.AddComponent <cakeslice.Outline>();
        }
    }
예제 #6
0
 /**
  * Cleanup an object. Set variables, outlines, and (if applicable) cleanup gizmo tools.
  */
 public void CleanupObj()
 {
     if (currentTool != Tool.ADD && currentTool != Tool.REMOVE)
     {
         CleanupToolOnObj();
     }
     cakeslice.Outline outline = selectedObj.GetComponent <cakeslice.Outline>();
     outline.color = 0;
     selectedObj   = null;
 }
 // Use this for initialization
 void Start()
 {
     menu = GetComponent <PopMenu>();
     if (!menu)
     {
         menu = gameObject.AddComponent <PopMenu>();
     }
     _outline         = GetComponent <cakeslice.Outline>();
     _outline.enabled = false;
 }
예제 #8
0
 /**
  * Select an object. Set variables, outlines, and (if applicable) setup gizmo tools.
  */
 public void SetupObj(GameObject obj)
 {
     selectedObj = obj;
     cakeslice.Outline outline = selectedObj.GetComponent <cakeslice.Outline>();
     outline.color = 1;
     if (currentTool != Tool.ADD && currentTool != Tool.REMOVE)
     {
         SetupToolOnObj(selectedObj, currentTool);
     }
 }
    void PossessionChoice()
    {
        RaycastHit hit;
        bool       isHit = Physics.Raycast(camTrans.position
                                           , camTrans.TransformDirection(Vector3.forward), out hit
                                           , 1000, 1 << 9 | 1 << 10);

        if (isHit)
        {
            cakeslice.Outline[] _outlineobject;
            if (ChoiceObject != null)
            {
                _outlineobject = ChoiceObject.GetComponentInParent <PhotonView>().
                                 GetComponentsInChildren <cakeslice.Outline>();
                for (int i = 0; i < _outlineobject.Length; i++)
                {
                    _outlineobject[i].enabled = false;
                }
                ChoiceObject.GetComponentInParent <khs_arrowI>().explan.gameObject.SetActive(false);
            }

            ChoiceObject = null;

            if (ChoiceObject == null)
            {
                ChoiceObject = hit.collider.GetComponentInChildren <cakeslice.Outline>();
            }
            _outlineobject = hit.collider.
                             GetComponentsInChildren <cakeslice.Outline>();
            for (int i = 0; i < _outlineobject.Length; i++)
            {
                _outlineobject[i].enabled = true;
            }
            ChoiceObject.enabled = true;
            CrossHair.SetBool("Cross", true);
            ChoiceObject.GetComponentInParent <khs_arrowI>().explan.gameObject.SetActive(true);
            ChoiceObject.GetComponentInParent <khs_arrowI>().explan.RotationExplan(CamBase.GetComponentInChildren <Transform>());
        }
        else
        {
            if (ChoiceObject != null)
            {
                ChoiceObject.GetComponentInParent <khs_arrowI>().explan.gameObject.SetActive(false);
                ChoiceObject.enabled = false;
                cakeslice.Outline[] _outlineobject = ChoiceObject.GetComponentInParent <PhotonView>().
                                                     GetComponentsInChildren <cakeslice.Outline>();
                for (int i = 0; i < _outlineobject.Length; i++)
                {
                    _outlineobject[i].enabled = false;
                }
                ChoiceObject = null;
                CrossHair.SetBool("Cross", false);
            }
        }
    }
예제 #10
0
    void Awake()
    {
        collider       = GetComponent <BoxCollider2D>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        highlight      = GetComponent <cakeslice.Outline>();
        animator       = GetComponent <Animator>();

        if (pickupObject)
        {
            Init(pickupObject);
        }
    }
예제 #11
0
 public void iterateThroughAll(Transform root, bool active)
 {
     foreach (Transform t in root)
     {
         cakeslice.Outline outline = root.GetComponent <cakeslice.Outline>();
         if (outline != null)
         {
             outline.eraseRenderer = !active;
         }
         iterateThroughAll(t, active);
     }
 }
예제 #12
0
 void LateUpdate()
 {
     if (Type == NatureObjectType.EnergySpot)
     {
         cakeslice.Outline outline = currentModel.GetComponent <cakeslice.Outline>();
         if (!outline)
         {
             outline = currentModel.gameObject.AddComponent <cakeslice.Outline>();
         }
         outline.color   = IsBroken() ? 1 : 0;
         outline.enabled = true;
     }
 }
    protected void Start()
    {
        outliner = GetComponent <cakeslice.Outline>();

        if (outliner == null)
        {
            outliner = OutlineObject;
        }

        outliner.enabled = false;

        CustomStart();
    }
예제 #14
0
    }                                         //  поиск пути

    // инициализация объекта
    void Start()
    {
        UnitManager.Instance.AddUnit(this);
        SpawnObject(new Vector2Int(Mathf.RoundToInt(gameObject.transform.position.x), Mathf.RoundToInt(gameObject.transform.position.z)));
        outline     = this.gameObject.GetComponentInChildren <cakeslice.Outline>();
        this.Player = PlayerController.ActivePlayer;
        foreach (var x in this.GetComponentInChildren <Renderer>().materials)
        {
            x.color = Player.Color;
        }
        timer           = this.gameObject.AddComponent <Timer>();
        timer.onElapsed = TimerElapsed;
    }
예제 #15
0
 // Use this for initialization
 void Start()
 {
     selected    = false;
     highlighted = false;
     if (!GetComponent <cakeslice.Outline>())
     {
         outline = gameObject.AddComponent <cakeslice.Outline>();
     }
     else
     {
         outline = gameObject.GetComponent <cakeslice.Outline>();
     }
     outline.enabled = false;
 }
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.T))
     {
         CheatPoss = !CheatPoss;
     }
     if (Input.GetKeyDown(KeyCode.E))
     {
         CrossHair.SetBool("Cross", false);
         inputCheck = !inputCheck;
         if (!inputCheck)
         {
             if (ChoiceObject != null)
             {
                 cakeslice.Outline[] _outlineobject = ChoiceObject.GetComponentInParent <PhotonView>().
                                                      GetComponentsInChildren <cakeslice.Outline>();
                 for (int i = 0; i < _outlineobject.Length; i++)
                 {
                     _outlineobject[i].enabled = false;
                 }
                 ChoiceObject.GetComponentInParent <khs_arrowI>().explan.gameObject.SetActive(false);
                 ChoiceObject.enabled = false;
             }
             ChoiceObject = null;
         }
         changePossParticle();         //here
     }
     if (inputCheck && !possEnabled)
     {
         PossessionChoice();
     }
     if (inputCheck && Input.GetMouseButtonDown(0) && isPossEnable)
     {
         inputCheck = false;
         if (ChoiceObject != null)
         {
             PossPart();
             StartCoroutine("PossessionLoadingbarIe");
             originPlayer.GetComponent <UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl>().Controllable = false;
             Invoke("PossessionGo", possessionDelay);
         }
     }
     if (End)
     {
         PlayerTimeUpdate();
     }
     PlayerPos = transform.position;
 }
예제 #17
0
 public void SetColor(EMKColor baseColor, EMKCellType type)
 {
     myType = type;
     if (type == EMKCellType.Target)
     {
         foreach (MeshRenderer meshRenderer in meshRendererList)
         {
             meshRenderer.enabled = false;
             cakeslice.Outline outline = meshRenderer.gameObject.AddComponent <cakeslice.Outline>();
             if (baseColor == EMKColor.Red)
             {
                 outline.color = 0;
             }
             else if (baseColor == EMKColor.Green)
             {
                 outline.color = 1;
             }
             else if (baseColor == EMKColor.Blue)
             {
                 outline.color = 2;
             }
         }
     }
     else if (type == EMKCellType.Movable)
     {
         foreach (MeshRenderer meshRenderer in meshRendererList)
         {
             //set outline
             cakeslice.Outline outline = meshRenderer.gameObject.AddComponent <cakeslice.Outline>();
             if (baseColor == EMKColor.Red)
             {
                 outline.color = 0;
             }
             else if (baseColor == EMKColor.Green)
             {
                 outline.color = 1;
             }
             else if (baseColor == EMKColor.Blue)
             {
                 outline.color = 2;
             }
             //set layer
             meshRenderer.gameObject.layer = LayerMask.NameToLayer("FurnitureRayLayer");
         }
     }
     furnitureColor = colorMap[baseColor];
 }
예제 #18
0
    void activate(PenController pc_in)
    {
        Debug.Log("activate");
        isActivated    = true;
        pc             = pc_in;
        pc.isActivated = false;

        pc.OnPressureExceed_01.AddListener(start_follow_pc_action);
        pc.OnPressureDeceed_01.AddListener(stop_follow_pc_action);

        if (pc.pressure_level != PenController.PRESSURE_LEVEL.LEVEL_0)
        {
            StartFollowPC();
        }

        cakeslice.Outline ot = this.gameObject.AddComponent <cakeslice.Outline>();
    }
예제 #19
0
    protected virtual void Start()
    {
        if (modelParent != null)
        {
            if (moveAnimation == null || idleAnimation == null || attackAnimation == null || deathAnimation == null)
            {
                Debug.LogWarning("Warning: " + CreatureName + " has insufficient animations set to assign an animation controller!");
            }
            else
            {
                moveAnimation.legacy            = true;
                idleAnimation.legacy            = true;
                attackAnimation.legacy          = true;
                deathAnimation.legacy           = true;
                animationController             = modelParent.AddComponent <Animation>();
                animationController.cullingType = AnimationCullingType.BasedOnRenderers;
                animationController.AddClip(moveAnimation, moveAnimation.name);
                animationController.AddClip(idleAnimation, idleAnimation.name);
                animationController.AddClip(attackAnimation, attackAnimation.name);
                animationController.AddClip(deathAnimation, deathAnimation.name);
            }

            if (GetComponent <Animator>() != null)
            {
                // Whilst I know that Animator is technically newer, the Animation component allows more generic code
                Debug.LogError("This class doesn't support the Animator - Please drag the animation clips into the appropriate slots and delete the Animator");
            }
        }

        if (model == null)
        {
            Debug.LogWarning("Please assign the model to this creature script!");
        }
        else
        {
            modelOutline         = model.AddComponent <ModelOutline>();
            modelOutline.color   = 0;
            modelOutline.enabled = false;
        }

        // Server only reads
        if (!Application.isEditor)
        {
            InvokeRepeating("NetCode", 0f, 0.1f);
        }
    }
예제 #20
0
 /// <summary>
 /// Check if need to disable outline effect
 /// </summary>
 private void CheckBlock()
 {
     cakeslice.Outline outline = m_RopeObj.GetComponent <cakeslice.Outline>();
     if (outline == null)
     {
         return;
     }
     if (tmp_m_OutlineShowTimeDelay > 0)
     {
         outline.enabled = true;
     }
     else
     {
         outline.enabled = false;
         player0Blocked  = false;
         player1Blocked  = false;
     }
 }
예제 #21
0
 void Start()
 {
     OutlineEffect         = transform.GetComponent <cakeslice.Outline>();
     OutlineEffect.enabled = false;
     owner = baseOf;
     if (baseOf != Globals.TEAMS.NONE)
     {
         setColor(ColorScheme.getColorOf(ColorScheme.color_context.BASE, baseOf));
         GameObject fl = Instantiate(Globals.InstanceGame.flagPrefab, transform.GetComponent <Renderer>().bounds.center, Globals.InstanceGame.flagPrefab.transform.rotation);
         fl.GetComponent <FlagController>().setColor(ColorScheme.getColorOf(ColorScheme.color_context.FLAG, baseOf));
         foreach (TerritoryController tc in Neighbours)
         {
             tc.setColor(ColorScheme.getColorOf(ColorScheme.color_context.BORDER, owner));
             if (Globals.InstancePlayer.team == owner)
             {
                 tc.available = true;
             }
         }
     }
 }
예제 #22
0
    void Start()
    {
        stats = GetComponent <Stats>();
        role  = GetComponent <Role>();
        unitAnimationScript = GetComponent <UnitAnimationScript>();
        spriteRenderer      = transform.GetChild(10).GetComponent <SpriteRenderer>();
        movementDestination = transform.position;
        cam = GameObject.Find("Main Camera").GetComponent <Camera>();
        gameManagerScript        = GameObject.Find("GameManager").GetComponent <GameManagerScript>();
        circleColliderGameobject = transform.GetChild(0).gameObject;
        outlineScript            = transform.GetChild(10).GetComponent <Outline>();
        cooldownImage            = transform.GetChild(7).GetComponent <Image>();
        soundsAudioSource        = GameObject.Find("SoundsAudioSource").GetComponent <AudioSource>();
        unitStatsTextScript      = gameObject.GetComponent <UnitStatsTextScript>();

        try { outlineScript.color = ownerIndex - 1; }
        catch (System.Exception) {};

        UpdateUnitStat();
    }
    private void UpdateShowScenerySelectionColour()
    {
        appStateManager.SetAnchorAndContainerIfNull();

        foreach (Transform item in appStateManager.currentSceneryContainer.transform)
        {
            //iterate over the collection of different trees, etc.
            GameObject currentSceneryItemObject = item.gameObject;
            Scenery    currentSceneryItem       = currentSceneryItemObject.GetComponent <Scenery>();

            //gotcha: be specific with "cakeslice" namespace - there is also an "Outline" class in the Unity.UI namespace
            cakeslice.Outline outline = currentSceneryItemObject.GetComponent <cakeslice.Outline>(); // the outline component that makes the 3D model highlighted

            if ((currentSceneryItem.isSelected || currentSceneryItem.isMoving))
            {
                if (outline == null)
                {
                    outline = currentSceneryItemObject.AddComponent(typeof(cakeslice.Outline)) as cakeslice.Outline;
                }

                if (currentSceneryItem.isSelected)
                {
                    outline.color = 1; //green  (defined on "Outline Effect" script attached to Camera)
                }

                if (currentSceneryItem.isMoving)
                {
                    outline.color = 0; //red
                }

                continue;
            }

            if (!(currentSceneryItem.isSelected || currentSceneryItem.isMoving) && (outline != null))
            {
                // no options selected - but an outline-component is present - so remove the component
                Destroy(outline);
                continue;
            }
        }
    }
예제 #24
0
    void deactivate()
    {
        try{
            pc.OnPressureExceed_01.RemoveListener(start_follow_pc_action);
            pc.OnPressureDeceed_01.RemoveListener(stop_follow_pc_action);
        }catch (System.Exception e) {
            Debug.Log("No listener to remove");
        }

        if (pc.pressure_level == PenController.PRESSURE_LEVEL.LEVEL_0)
        {
            StopFollowPC();
        }

        isActivated    = false;
        pc.isActivated = true;
        pc             = null;

        cakeslice.Outline ot = this.gameObject.GetComponent <cakeslice.Outline>();
        Destroy(ot);
    }
예제 #25
0
    private void BuildBrainPiece(byte[] objData, string objName)
    {
        GameObject targetObject = ObjIOLoad(objData);

        targetObject.name = objName;

        //set up the components
        GameObject importantChild = targetObject.GetComponentInChildren <MeshRenderer>().gameObject;

        //GameObject importantChild = targetObject.transform.GetChild(0).GetChild(0).GetChild(0).gameObject; //is this faster?  signs point to no
        importantChild.AddComponent <MeshCollider>();
        importantChild.AddComponent <MouseOverOutline> ().outline = importantChild.AddComponent <cakeslice.Outline> ();
        cakeslice.Outline clickOutline = importantChild.AddComponent <cakeslice.Outline> ();
        clickOutline.color   = 1;
        clickOutline.enabled = false;
        importantChild.GetComponent <MouseOverOutline> ().clickOutline = clickOutline;
        importantChild.AddComponent <BrainPiece> ();
        importantChild.name = targetObject.name;

        if (objName.Contains("hcp") && objName.Contains("lh"))
        {
            targetObject.transform.parent = hcpLeftParent.transform;
        }
        else if (objName.Contains("hcp") && objName.Contains("rh"))
        {
            targetObject.transform.parent = hcpRightParent.transform;
        }
        else if (objName.Contains("lh"))
        {
            targetObject.transform.parent = dkLeftParent.transform;
        }
        else if (objName.Contains("rh"))
        {
            targetObject.transform.parent = dkRightParent.transform;
        }
        else
        {
            throw new UnityException("An obj with an unrecorgnized naming exists.");
        }
    }
예제 #26
0
        //Check if there's any interactive object at next tile to interact
        private void CheckInteractiveObject()
        {
            RaycastHit[] interactives = Physics.RaycastAll(gameObject.transform.position + Vector3.up * 0.1f, gameObject.transform.rotation * Vector3.forward, 1, LayerMask.GetMask("Interactive", "Interactive;Climbable"));
            if (interactives.Length > 0)
            {
                if (interactives[0].collider != _interactiveObject)
                {
                    ClearInteractiveObject();

                    _interactiveObject = interactives[0].collider;
                    if (!_replayOnly)
                    {
                        if (_interactiveObject.GetComponent <MeshRenderer>() != null)
                        {
                            cakeslice.Outline outline = _interactiveObject.gameObject.AddComponent <cakeslice.Outline>();
                            outline.color         = 0;
                            outline.eraseRenderer = false;
                        }
                        else
                        {
                            for (int i = 0; i < _interactiveObject.transform.childCount; i++)
                            {
                                GameObject child = _interactiveObject.transform.GetChild(i).gameObject;
                                if (child.GetComponent <MeshRenderer>() != null)
                                {
                                    cakeslice.Outline outline = child.AddComponent <cakeslice.Outline>();
                                    outline.color         = 0;
                                    outline.eraseRenderer = false;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                ClearInteractiveObject();
            }
        }
예제 #27
0
 public void Outline()
 {
     foreach (FiringPoint Point in Weapon.Points)
     {
         RaycastHit hit;
         var        dir    = Quaternion.Euler(Point.Emmision.RotationOffset) * this.transform.forward;
         Ray        ray    = new Ray(this.transform.position, this.transform.forward);
         var        Layers = ~(1 << LayerMask.NameToLayer("Player") | 1 << LayerMask.NameToLayer("Pieces") | 1 << LayerMask.NameToLayer("Bullets") | 1 << LayerMask.NameToLayer("Manipulators"));
         if (Physics.Raycast(ray, out hit, Point.Shooting.Range, Layers))
         {
             if (hit.transform != this.transform)
             {
                 if (!hit.transform.gameObject.GetComponent <cakeslice.Outline>())
                 {
                     hit.transform.gameObject.AddComponent <cakeslice.Outline>();
                 }
                 if (hit.transform.gameObject != OutlinedObject)
                 {
                     if (OutlinedObject != null)
                     {
                         cakeslice.Outline o = OutlinedObject.GetComponent <cakeslice.Outline>();
                         Destroy(o);
                     }
                     OutlinedObject = hit.transform.gameObject;
                 }
             }
         }
         else
         {
             if (OutlinedObject != null)
             {
                 cakeslice.Outline o = OutlinedObject.GetComponent <cakeslice.Outline>();
                 Destroy(o);
                 OutlinedObject = null;
             }
         }
     }
 }
예제 #28
0
        private void ClearInteractiveObject()
        {
            if (_interactiveObject != null)
            {
                Interactive.Interactive interactive = _interactiveObject.GetComponent <Interactive.Interactive>();
                if (interactive.IsInteracting)
                {
                    interactive.DeInteract(gameObject);
                }

                if (_interactiveObject.GetComponent <MeshRenderer>() != null)
                {
                    cakeslice.Outline outline = _interactiveObject.GetComponent <cakeslice.Outline>();
                    if (outline != null && !_replayOnly)
                    {
                        Destroy(outline);
                    }
                }
                else
                {
                    for (int i = 0; i < _interactiveObject.transform.childCount; i++)
                    {
                        GameObject child = _interactiveObject.transform.GetChild(i).gameObject;
                        if (child.GetComponent <MeshRenderer>() != null)
                        {
                            cakeslice.Outline outline = child.GetComponent <cakeslice.Outline>();
                            if (outline != null && !_replayOnly)
                            {
                                Destroy(outline);
                            }
                        }
                    }
                }


                _interactiveObject = null;
            }
        }
예제 #29
0
    void Start()
    {
        player_detect_speed = EnemyService.get_detect_interval(entity.rank);
        nmSurface           = GameObject.FindGameObjectWithTag("SystemManager").GetComponent <NavMeshSurface>();
        nmAgent             = GetComponent <NavMeshAgent>();
        animator            = GetComponent <Animator>();
        outline             = GetComponentInChildren <Outline>();
        collider            = GetComponent <Collider>();

        Observable.Interval(TimeSpan.FromMilliseconds(player_detect_speed)).Subscribe(x => {
            // プレイヤー位置を取得する
            player_position = PlayerService.position();
        }).AddTo(this);

        character_control = true;
        DoMoveMode();

        //Debug.Log("EnemyController : id : " + id);
        //Debug.Log("EnemyController : entity.name : " + entity.name);

        //this.UpdateAsObservable().ObserveOnMainThread().Subscribe(x => {
        //});
    }
    void SpliceTerritory(List <MapRegion> zones)
    {
        sectors.Clear();

        GameObject territories = new GameObject("Territories");

        territories.transform.parent        = transform;
        territories.transform.localPosition = Vector3.zero;
        territories.transform.localRotation = Quaternion.identity;

        int zoneCount = 1;

        foreach (MapRegion zone in zones)
        {
            SectorInfo sector = new SectorInfo();
            sector.id     = zoneCount;
            sector.offset = zone.GetCentre() * islandData.tileSize;

            sector.gameObject = AddChildMesh("Zone " + sector.id, territories.transform);
            sector.gameObject.transform.localPosition = sector.offset;

            sector.gameObject.GetComponent <MeshFilter> ().mesh       = meshGen.GenerateZoneMesh(zone, sector, islandData.tileSize, vertDatabase);
            sector.gameObject.GetComponent <MeshRenderer> ().material = islandData.invisibleMaterial;
            if (debug)
            {
                sector.gameObject.GetComponent <MeshRenderer> ().material.color = randCol[(zoneCount % 20)];
            }

            cakeslice.Outline outlineComponent = sector.gameObject.AddComponent <cakeslice.Outline> ();
            outlineComponent.color = zoneCount % 3;

            sectors.Add(sector);
            zoneCount++;
        }

        territories.AddComponent <CycleRegionOutline> ();
    }