Exemplo n.º 1
0
 private void Start()
 {
     gt = GameObject.FindGameObjectWithTag("GridController").GetComponent <GridTester>();
     ControlFactors.DAY_LENGTH   = dayLength;
     ControlFactors.CURRENT_TIME = dayLength / 7;
     setTime();
 }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        gt          = GameObject.FindGameObjectWithTag("GridController").GetComponent <GridTester>();
        tileList    = gt.GetComponent <TileLists>();
        profList    = gt.GetComponent <ProfessionList>();
        population  = new List <Man>();
        spawnPos    = transform.position;
        spawnPos.y -= 1.25f;
        SetTile();
        //tileObject.transform.localScale = ControlFactors.isometricScale;

        //Testing Purposes: Fills in Grid:
        //stage = Stage.one;
        //SetTile();
    }
    // Start is called before the first frame update
    void Start()
    {
        badSpellChoice  = BadSpellType.Squish;
        goodSpellChoice = GoodSpellType.Bless;
        spellQueue      = new List <Spell>();
        gt   = GameObject.FindGameObjectWithTag("GridController").GetComponent <GridTester>();
        uih  = gt.GetComponent <UIHandler>();
        mesh = new Mesh();

        /*
         * Vector3[] verticies =
         *          {
         *              new Vector3(-gt.mapWidth * gt.gridNodeWidth - gt.gridNodeWidth, 0),
         *              new Vector3(-gt.gridNodeWidth,gt.mapHeight  * gt.gridNodeHeight),
         *              new Vector3(gt.mapWidth * gt.gridNodeWidth - gt.gridNodeWidth, 0),
         *              new Vector3(-gt.gridNodeWidth,-gt.mapHeight * gt.gridNodeHeight)
         *          };
         * mesh.vertices = verticies;
         * mesh.triangles = new int[] { 0, 1, 2, 0, 2, 3 };*/
        float          angleStep    = 360.0f / (float)gt.Land.numOfPoints;
        List <Vector3> vertexList   = new List <Vector3>();
        List <int>     triangleList = new List <int>();
        Quaternion     quaternion   = Quaternion.Euler(0.0f, 0.0f, angleStep);

        // Make first triangle.
        vertexList.Add(new Vector3(0.0f, 0.0f, 0.0f));                  // 1. Circle center.
        vertexList.Add(new Vector3(0.0f, gt.Expansion_Distance, 0.0f)); // 2. First vertex on circle outline (radius = 0.5f)
        vertexList.Add(quaternion * vertexList[1]);                     // 3. First vertex on circle outline rotated by angle)
                                                                        // Add triangle indices.
        triangleList.Add(0);
        triangleList.Add(1);
        triangleList.Add(2);
        for (int i = 0; i < gt.Land.numOfPoints - 1; i++)
        {
            triangleList.Add(0);                      // Index of circle center.
            triangleList.Add(vertexList.Count - 1);
            triangleList.Add(vertexList.Count);
            vertexList.Add(quaternion * vertexList[vertexList.Count - 1]);
        }
        mesh.vertices  = vertexList.ToArray();
        mesh.triangles = triangleList.ToArray();
        GetComponent <MeshFilter>().mesh         = mesh;
        GetComponent <MeshCollider>().sharedMesh = mesh;
    }
Exemplo n.º 4
0
    // Start is called before the first frame update
    void Start()
    {
        gt            = GameObject.FindGameObjectWithTag("GridController").GetComponent <GridTester>();
        canvasUI      = GameObject.FindGameObjectWithTag("Canvas").GetComponent <Canvas>();
        mainCamera    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
        spriteHandler = GetComponent <ManSpriteHandler>();
        rb            = GetComponent <Rigidbody2D>();
        ani           = GetComponent <Animator>();
        path          = GetComponent <AIPath>();
        seeker        = GetComponent <Seeker>();
        brain         = new ManBrain(this);

        homeTile = transform.parent.GetComponent <MapTile>();
        home     = homeTile.spawnPos;

        resting = false;
        seeker.StartPath(ABPath.Construct(transform.position, home, null));
        SetSeeker(false);
        path.maxSpeed = speed;

        ani.Play("Idle", 0, Random.Range(0, ani.GetCurrentAnimatorStateInfo(0).length));
    }
Exemplo n.º 5
0
 void Start()
 {
     gt = GameObject.FindGameObjectWithTag("GridController").GetComponent <GridTester>();
 }
Exemplo n.º 6
0
 public Population(GridTester gt)
 {
     populationList = new List <Man>();
     this.gt        = gt;
 }