示例#1
0
	public void init(int tileType, BoardManager board) {
		this.board = board;
		turnCount = 0;
		tileObj = GameObject.CreatePrimitive(PrimitiveType.Quad);
		tileMod = tileObj.AddComponent<TileModel>();
		tileMod.init(this, type);
	}
示例#2
0
文件: Hex.cs 项目: jaisrael1/Grow
 public void addCloud(bool isRainy)
 {
     if (type == AIR && !hasCloud)
     {
         hasCloud = true;
         var modelObject2 = GameObject.CreatePrimitive(PrimitiveType.Quad);
         extraTileModel = modelObject2.AddComponent <TileModel> ();
         if (isRainy)
         {
             extraTileModel.init(this, TileModel.RAIN_CLOUD_MODEL);
         }
         else
         {
             extraTileModel.init(this, TileModel.CLOUD_MODEL);
         }
     }
 }
示例#3
0
 public void init(int tileType, BoardManager board)
 {
     this.board = board;
     turnCount  = 0;
     tileObj    = GameObject.CreatePrimitive(PrimitiveType.Quad);
     tileMod    = tileObj.AddComponent <TileModel>();
     tileMod.init(this, type);
 }
示例#4
0
	public void init(int tile_type) {
        this.tile_type = tile_type;

       	GameObject modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
        model = modelObject.AddComponent<TileModel>();
        model.init(tile_type, this);

		orientation = Quaternion.Euler(0f, 0f, (orientation.eulerAngles.z - (90f*Random.Range(0, 4))) % 360f);
		transform.localRotation = orientation;
    }
示例#5
0
	public void addTurn(){
		this.tiletype = 2;

		turn = true;
		S = true;
		E = true;

		var modelObject2 = GameObject.CreatePrimitive (PrimitiveType.Quad);
		model2 = modelObject2.AddComponent<TileModel> ();
		model2.init (x, y, 2, this, modelObject2);

	}
示例#6
0
    public void init(int tile_type)
    {
        this.tile_type = tile_type;

        GameObject modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);

        model = modelObject.AddComponent <TileModel>();
        model.init(tile_type, this);

        orientation             = Quaternion.Euler(0f, 0f, (orientation.eulerAngles.z - (90f * Random.Range(0, 4))) % 360f);
        transform.localRotation = orientation;
    }
示例#7
0
    private bool hasTower;      // if a tower has been placed

    public void init(int x, int y, GameManager m)
    {
        manager  = m;
        hasTower = false;

        var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // create quad

        modelObject.SetActive(true);                                      // makes sure the quad is being displayed
        model = modelObject.AddComponent <TileModel>();                   // add TileModel script to quad
        model.transform.parent        = this.transform;                   // make it the child of the Tile object
        model.transform.localPosition = new Vector3(0, 0, 0);             // position relative to global coords

        model.init(this);
    }
示例#8
0
文件: Hex.cs 项目: jaisrael1/Grow
    public void init(int coordX, int coordY, float realX, float realY, Controller c)
    {
        this.coordX = coordX;
        this.coordY = coordY;
        this.realX  = realX;
        this.realY  = realY;
        controller  = c;

        contains = NOTHING;
        hasCloud = false;

        collider           = this.gameObject.AddComponent <CircleCollider2D> ();
        collider.radius    = Mathf.Sqrt(3) / 4f - 0.05f;
        collider.isTrigger = true;

        var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);

        model = modelObject.AddComponent <HexModel> ();
        model.init(this);

        hex_edges        = new ArrayList();
        branches_leaving = new ArrayList();
        occupied         = false;


        //rootSounds = new ArrayList (controller.audioM.root1, controller.audioM.root2, controller.audioM.root3,
        //	controller.audioM.root4, controller.audioM.root5, controller.audioM.root6, controller.audioM.root7,
        //		controller.audioM.root8, controller.audioM.root9, controller.audioM.root10, controller.audioM.root11,
        //		controller.audioM.root12);

        if (coordY < 0)
        {
            type = GROUND;
            this.gameObject.tag = "ground_hex";
            var modelObject2 = GameObject.CreatePrimitive(PrimitiveType.Quad);
            tileModel = modelObject2.AddComponent <TileModel> ();
            tileModel.init(this, TileModel.GROUND_MODEL);
        }
        else
        {
            type = AIR;
            this.gameObject.tag = "air_hex";
        }
    }
示例#9
0
    public void init(int type, int boardx, int boardy)
    {
        //determine the type, make the correct quad, add quad to currentMarbles, build the dictionary map whatever thing for outward direction
        this.type     = type;
        source        = GetComponent <AudioSource>();
        getOutward    = new Dictionary <int, int>();
        boardPosition = new Vector2(boardx, boardy);
        GameObject modelObject;

        parent         = GameObject.Find("MarbleManager").GetComponent <MarbleManager>();;
        currentMarbles = new List <Marble>();
        hasGem         = false;


        if (type == 0)
        {
            modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);
            // Create a quad object for holding the gem texture.
            out1 = 7;
            out2 = out1;
        }
        else if (type == 2)
        {
            modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);

            out1 = -1;
            out2 = out1;
        }
        else
        {
            modelObject = new GameObject();
            out1        = 1;
            out2        = 2;
            //make a new child with two quads and a script for controlling the quads
        }
        //tileModel.init(type, position, owner)
        populateOutward();
        model = modelObject.AddComponent <TileModel>();
        model.init(type, this);
    }
示例#10
0
	public void addPit(){
		this.tiletype = 3;

		pit = true;

		var modelObject2 = GameObject.CreatePrimitive (PrimitiveType.Quad);
		modelObject2.tag = "pit";
		model2 = modelObject2.AddComponent<TileModel> ();

		MeshCollider mc = modelObject2.GetComponent<MeshCollider> ();
		mc.enabled = false;

		BoxCollider bc = modelObject2.AddComponent<BoxCollider> ();
		bc.size = new Vector3(.1f, .1f, 3);
		Rigidbody rb = modelObject2.AddComponent<Rigidbody> ();
		rb.useGravity = false;
		rb.isKinematic = false;

		model2.init (x, y, 3, this, modelObject2);
	}
示例#11
0
	public void addEmptyTexture(){
		var modelObject1 = GameObject.CreatePrimitive (PrimitiveType.Quad);	
		model1 = modelObject1.AddComponent<TileModel> ();						
		model1.init (x, y, 1, this, modelObject1);
	}