Ejemplo n.º 1
0
    // Use this for initialization
    protected void Start()
    {
        //Here be dragons
        um = GameObject.FindObjectOfType <UnitManager>();
        em = GameObject.FindObjectOfType <EnemyManager>();

        LADDERINDEX = TileSpecList.getTileSpecInt("Ladder");

        currentMovement = new Vector2(0, 0);

        map = GameObject.FindObjectOfType <Map>();

        currentState = movementState.IDLE;

        //Start the pathing coroutine
        StartCoroutine(getPath());
        StartCoroutine(computeState());
        cc       = GetComponent <CharacterController>();
        position = new Vector2(Mathf.RoundToInt(this.transform.position.x), Mathf.RoundToInt(this.transform.position.y));

        selected = false;
        this.transform.localScale = new Vector3(size, size, size);

        this.right = Random.value > .5f;
    }
Ejemplo n.º 2
0
    public void grab()
    {
        int i = TileSpecList.getTileSpecInt("Ladder");

        if (onLadder())
        {
            climbing = true;
        }
    }
Ejemplo n.º 3
0
 public void populateCluster(TileCluster t)
 {
     for (int x = t.x; x < t.x + t.width; x++)
     {
         for (int y = t.y; y < t.y + t.height; y++)
         {
             if (Random.value < t.likeliness)
             {
                 byte layerID = (byte)(t.background?(BACKGROUND_ID):FOREGROUND_ID);
                 setByte(new IVector2(x, y), layerID, ((byte)TileSpecList.getTileSpecInt(t.tileType)));
                 updateTileSpec(new IVector2(x, y));
             }
         }
     }
 }
Ejemplo n.º 4
0
    public void draw()
    {
        Map         m   = GameObject.FindObjectOfType <Map>();
        IVector2    pos = new IVector2(this.transform.position.x, this.transform.position.y);
        TileCluster t   = towerCluster.copy();

        for (int x = t.x; x < t.x + t.width; x++)
        {
            for (int y = t.y; y < t.y + t.height + 2; y++)
            {
                if (Random.value < t.likeliness)
                {
                    m.setTile(new IVector2(pos.x + x, pos.y + y), (byte)0, (byte)TileSpecList.getTileSpecInt(towerCluster.tileType));
                }
            }
        }
    }