Example #1
0
    void Start()
    {
        fogParticleController = this;

        //incrementStart = 0;
        xSize          = 64;
        zSize          = 64;
        ySize          = 10;
        particleCount  = xSize * zSize * ySize;
        heightModifier = Vector3.up * .5f;
        fadeColors     = new Color32[] { new Color32(0, 0, 0, 255), new Color32(0, 0, 0, 239), new Color32(0, 0, 0, 223), new Color32(0, 0, 0, 207),
                                         new Color32(0, 0, 0, 191), new Color32(0, 0, 0, 175), new Color32(0, 0, 0, 159), new Color32(0, 0, 0, 143),
                                         new Color32(0, 0, 0, 127), new Color32(0, 0, 0, 111), new Color32(0, 0, 0, 95), new Color32(0, 0, 0, 79),
                                         new Color32(0, 0, 0, 63), new Color32(0, 0, 0, 47), new Color32(0, 0, 0, 31), new Color32(0, 0, 0, 15),
                                         new Color32(0, 0, 0, 0) };

        unitCount             = UnitController.playerUnits.Count;
        previousUnitPositions = new Vector3[4];

        for (int i = 0; i < unitCount; i++)
        {
            previousUnitPositions[i] = new Vector3(-1, -1, -1);
        }

        fogParticleSystem = GetComponent <ParticleSystem>();
        visionMask        = LayerMask.GetMask(new string[3] {
            "Swapable Object", "Debris", "Indestructable Terrain"
        });

        fadingParticles = new HashSet <int>();
        particles       = new Particle[particleCount];
        particleHolder  = new ParticleSystem.Particle[particleCount];

        enemyVisionVectors = new Vector3[] { new Vector3(.5f, .5f, .5f), new Vector3(-.5f, .5f, .5f), new Vector3(.5f, .5f, -.5f), new Vector3(-.5f, .5f, -.5f),
                                             new Vector3(.5f, -.5f, .5f), new Vector3(-.5f, -.5f, .5f), new Vector3(.5f, -.5f, -.5f), new Vector3(-.5f, -.5f, -.5f) };

        StartCoroutine("DelayedUpdate");
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        gameController = this;
        activeObjects  = 0;
        selectedAction = -1;
        uiPressed      = -1;
        abilityUI      = AbilityUI.abilityUI;
        abilitiesUI    = AbilityUI.abilitiesUI;
        confirmUI      = AbilityUI.confirmUI;
        endTurnUI      = AbilityUI.endTurnUI;
        mainCamera     = Camera.main;

        playerState = States.NothingSelected;
        Vector3 startLocation = GetComponent <LevelGenerator>().GenerateLevel(6, 6);

        warpPad = GameObject.Find("Warp Pad(Clone)");
        navMeshSurface.BuildNavMesh();
        preloadCount          = 0;
        debrisList            = new GameObject[40];
        fogParticleController = fogParticleSystem.GetComponent <FogParticleController>();

        CameraSnapTo(startLocation + Vector3.up);
        GameObject.Instantiate(playerUnitPrefab, startLocation + Vector3.up + Vector3.left * 3, Quaternion.identity);
        GameObject.Instantiate(playerUnitPrefab, startLocation + Vector3.up + Vector3.right * 3, Quaternion.identity);

        RaycastHit hit;
        Vector3    randomLoc;

        for (int i = 0; i < 20; i++)
        {
            do
            {
                randomLoc = new Vector3(Random.Range(3, 63), 10, Random.Range(3, 63));
            } while (Vector3.Distance(startLocation, randomLoc) < 20);
            Physics.Raycast(randomLoc, Vector3.down, out hit, 11, ~LayerMask.GetMask("Ignore Raycast"));
            GameObject.Instantiate(enemyUnitPrefab, hit.point + Vector3.up, Quaternion.identity);
        }
    }