示例#1
0
 public void OnDrawGizmos(IsoWorld iso_world)
 {
     if (iso_world.isShowQuadTree)
     {
         _quadTree.VisitAllBounds(_qtBoundsLU);
     }
 }
示例#2
0
    // Use this for initialization
    void Start()
    {
        enemy = GameObject.Find("Enemy");
        hero  = GameObject.Find("Hero");


        for (int x = 0; x < 30; x++)
        {
            for (int y = 0; y < 30; y++)
            {
                world = GameObject.Find("Camera").GetComponent <IsoWorld>();


                // Gera a grade baseado nas posições isometricas de 0,0 à n,n
                Vector3 worldPoint = new Vector3(x, y, 0);

                // Converte posição para isometrico
                var newWorldPoint = world.IsoToScreen(worldPoint);


                if (Physics2D.OverlapCircle(newWorldPoint, 0.2f, enemyLayer))
                {
                    Debug.Log("Colisao detectada com OverlapCircle na grade : newWorldPoint = " + newWorldPoint);
                }
            }
        }
    }
示例#3
0
        // ---------------------------------------------------------------------
        //
        // Internal
        //
        // ---------------------------------------------------------------------

        public void Internal_ResetIsoWorld()
        {
            if (_isoWorld)
            {
                _isoWorld.Internal_RemoveIsoObject(this as IsoObject);
                _isoWorld = null;
            }
        }
 static void DrawIsoCubeVert(IsoWorld iso_world, Vector3 pos, Vector3 size)
 {
     if (iso_world)
     {
         var point0 = iso_world.IsoToScreen(pos);
         var point1 = iso_world.IsoToScreen(pos + IsoUtils.Vec3FromZ(size.z));
         Handles.DrawLine(point0, point1);
     }
 }
示例#5
0
        // ---------------------------------------------------------------------
        //
        // Public
        //
        // ---------------------------------------------------------------------

        public void StepSortingAction(IsoWorld iso_world)
        {
            Profiler.BeginSample("IsoScreenSolver.ProcessParents");
            ProcessParents();
            Profiler.EndSample();
            Profiler.BeginSample("IsoScreenSolver.ProcessVisibles");
            ProcessVisibles(iso_world.isSortInSceneView);
            Profiler.EndSample();
        }
示例#6
0
 // Use this for initialization
 void Start()
 {
     isoWorld           = FindObjectOfType <IsoWorld>();
     boardHolder        = isoWorld.transform;
     puck               = Instantiate(puckObject, new Vector3(0f, 0f, 0f), Quaternion.identity, boardHolder) as GameObject;
     puckData           = puck.GetComponent <TangibleCollider>();
     puckData.tileIndex = puckIndex;
     iso = puck.GetComponent <IsoObject>();
 }
        void Start()
        {
            if (!alienBallPrefab)
            {
                throw new UnityException("AlienBallSpawner. Alien ball prefab not found!");
            }
            var iso_world = IsoWorld.GetWorld(0);

            StartCoroutine(SpawnAlienBall(iso_world));
        }
示例#8
0
 public void Internal_RecacheIsoWorld()
 {
     Internal_ResetIsoWorld();
     if (IsActive())
     {
         _isoWorld = FindFirstActiveWorld();
         if (_isoWorld)
         {
             _isoWorld.Internal_AddIsoObject(this as IsoObject);
         }
     }
 }
        // ---------------------------------------------------------------------
        //
        // Debug draw
        //
        // ---------------------------------------------------------------------

        #if UNITY_EDITOR
        static void DrawIsoCubeTop(IsoWorld iso_world, Vector3 pos, Vector3 size)
        {
            if (iso_world)
            {
                var point0 = iso_world.IsoToScreen(pos);
                var point1 = iso_world.IsoToScreen(pos + IsoUtils.Vec3FromX(size.x));
                var point2 = iso_world.IsoToScreen(pos + IsoUtils.Vec3FromXY(size.x, size.y));
                var point3 = iso_world.IsoToScreen(pos + IsoUtils.Vec3FromY(size.y));
                Handles.DrawLine(point0, point1);
                Handles.DrawLine(point1, point2);
                Handles.DrawLine(point2, point3);
                Handles.DrawLine(point3, point0);
            }
        }
 IEnumerator SpawnAlienBall(IsoWorld iso_world)
 {
     while (true)
     {
         var aliens = GameObject.FindObjectsOfType <AlienBallController>();
         if (aliens.Length < maxAlienCount)
         {
             var dx            = Random.Range(2.0f, 3.0f);
             var dy            = Random.Range(2.0f, 3.0f);
             var alien_ball_go = Instantiate(alienBallPrefab, iso_world.transform);
             var alien_iso_obj = alien_ball_go.GetComponent <IsoObject>();
             alien_iso_obj.position = new Vector3(dx, dy, 5.0f);
         }
         yield return(new WaitForSeconds(Random.Range(2.0f, 5.0f)));
     }
 }
    public void SetupScene()
    {
        // init steps

        dataController = FindObjectOfType <DataController>();

        boardHolder = board.transform;
        isoWorld    = FindObjectOfType <IsoWorld>();
        //Debug.Log(isoWorld);
        canvas = GameObject.Find("uiCanvas").transform;
        Populate();


        //removing for free play
        //CheckAndActivatePrompts();
        ActivateAllPrompts();
    }
 public static void DrawIsoGrid(
     IsoWorld iso_world, Vector3 pos, Vector3 size, Color color)
 {
     if (iso_world)
     {
         Handles.color = color;
         var size_x = Mathf.RoundToInt(size.x);
         var size_y = Mathf.RoundToInt(size.y);
         for (var i = 0; i <= size_x; ++i)
         {
             Handles.DrawLine(
                 iso_world.IsoToScreen(new Vector3(pos.x + i, pos.y + 0.0f, pos.z)),
                 iso_world.IsoToScreen(new Vector3(pos.x + i, pos.y + size_y, pos.z)));
         }
         for (var i = 0; i <= size_y; ++i)
         {
             Handles.DrawLine(
                 iso_world.IsoToScreen(new Vector3(pos.x + 0.0f, pos.y + i, pos.z)),
                 iso_world.IsoToScreen(new Vector3(pos.x + size_x, pos.y + i, pos.z)));
         }
     }
 }
示例#13
0
        void Start()
        {


            IsNear = false;
            move = false;
            canStart = true;
            npc_start = true;
            MoveTiming = true;

            NPCCharacter = GetComponent<NPCBase>();
            seekerIso = GetComponent<IsoObject>();
            seekerRigidybody = GetComponent<IsoRigidbody>();

            cachedSeekerPos = seekerIso.position;
            cachedTargetPos = _targetPos.GetComponent<IsoObject>().position;

            _targetIsoObject = _targetPos.GetComponent<IsoObject>();

            world = GameObject.Find("Camera").GetComponent<IsoWorld>();


        }