예제 #1
0
    void Start()
    {
        //Loading in prefabs
        cube     = Resources.Load <Transform>("Buildings/Cube");
        sphere   = Resources.Load <Transform>("Buildings/Sphere");
        cylinder = Resources.Load <Transform>("Buildings/Cylinder");
        peasant  = Resources.Load <Transform>("Peasant");
        road     = Resources.Load <Transform>("Buildings/Road");

        //Events
        EventHandler.OnCollisionWithScenery     += GetCollision;
        EventHandler.OnCollisionWithSceneryExit += ExitCollision;

        //Assigning
        mesh          = gameObjectToPlaceSize.GetComponent <MeshRenderer>();
        placementSize = gameObjectToPlaceSize.GetComponent <PlacementSize>();

        //Other stuff
        gameObjectToPlaceSize.SetActive(placeObjectActive);
        blockChosen = false;
        canPlace    = true;
    }
예제 #2
0
    public static Vector2 CreatePlacement(string placementName, PlacementSize placementSize)
    {
        Log("CreatePlacement placementName:" + placementName + " placementSize: " + placementSize);
        string text = "0x0";

        if (Application.platform == RuntimePlatform.Android && _plugin != null)
        {
            text = _plugin.Call <string>("aatkitCreatePlacement", new object[2]
            {
                placementName,
                (int)placementSize
            });
        }
        if (Application.isEditor && AATKitPlaceholderManager.Instance != null)
        {
            AATKitPlaceholderManager.Instance.CreatePlacement(placementName, placementSize);
        }
        char[] separator = new char[1]
        {
            'x'
        };
        string[] array = text.Split(separator);
        int      num;
        int      num2;

        try
        {
            num  = int.Parse(array[0]);
            num2 = int.Parse(array[1]);
        }
        catch (Exception exception)
        {
            UnityEngine.Debug.LogException(exception);
            num  = 0;
            num2 = 0;
        }
        return(new Vector2(num, num2));
    }