Exemplo n.º 1
0
    public void generateObstacle(int idRegion)
    {
        List <ObstacleData> obstacleList = LoadData.Instance.RegionInfo[idRegion].ObstaclesList;

        for (int i = 0; i < obstacleList.Count; i++)
        {
            GameObject obstacle = Controller.Instance.generateGameObj(obstacleList[i].LocationObstacle, ObstacleParent);
            Vector3    pos      = obstacle.transform.position;
            // pos.x += i*2;
            pos.y -= i;
            obstacle.transform.position = pos;
            ObstacleObj script = obstacle.AddComponent <ObstacleObj>();
            script.ObstacleInfoObj = obstacleList[i];
        }
    }
Exemplo n.º 2
0
    void ObstacleHited(GameObject go)
    {
        ObstacleObj obsScr = go.GetComponent <ObstacleObj>();

        if (ToolController.Instance.selectTool == EToolsType.brush)
        {
            if (obsScr.ObstacleInfoObj.UseTool == ToolType)
            {
                Debug.Log("HitOnstacle");
                obsScr.CountClick++;
                if (obsScr.CountClick >= obsScr.ObstacleInfoObj.NumberScrachToDestroy)
                {
                    StuffDestroyObstacle(go);
                }
            }
        }
    }