Example #1
0
    void Start()
    {
        _cameraXPosition = _width * 0.5f - _tileSize * 0.5f;
        _cameraZPosition = _height * 0.5f - _tileSize * 0.5f;
        _cameraYPosition = 10.0f;

        _cameraForward = new Vector3(0, -1, 0);
        _cameraUp      = new Vector3(0, 0, 1);

        _camera = Camera.main;
        _camera.transform.position = new Vector3(_cameraXPosition, _cameraYPosition, _cameraZPosition);
        _camera.transform.rotation = Quaternion.LookRotation(_cameraForward, _cameraUp);

        _grid = new Script_Grid();
        _grid.InstantiateGrid(10, 10, 0);

        _friendlyList      = new List <Script_IEntity> ();
        _enemyList         = new List <Script_IEntity> ();
        _projectileList    = new List <Script_IProjectile>();
        _visualEffectsList = new List <Script_IVisual> ();

        _damageDealer = new Script_DamageDealer(this, _grid, new Vector3Int(6, 0, 5));
        _friendlyList.Add(_damageDealer);
        _healer = new Script_Healer(this, _grid, new Vector3Int(4, 0, 5));
        _friendlyList.Add(_healer);
        _tank = new Script_Tank(this, _grid, new Vector3Int(5, 0, 5));
        _friendlyList.Add(_tank);

        _tank.InitializeBehaviourTree();
        _healer.InitializeBehaviourTree();
        _damageDealer.InitializeBehaviourTree();

        _enemySpawner = new Script_EnemySpawner(this, _grid);
    }
    void Awake()
    {
        _tileHeight           = -1.0f;
        _senseTimerFrequency  = 1.0f;
        _decideTimerFrequency = 1.0f / 2.0f;
        _actTimerFrequency    = 1.0f / 30.0f;


        senseTimer  = 0.0f;
        decideTimer = 0.0f;
        actTimer    = 0.0f;

        cameraXPosition = width * 0.5f - tileSize * 0.5f;
        cameraZPosition = height * 0.5f - tileSize * 0.5f;
        cameraYPosition = 10.0f;

        cameraForward = new Vector3(0, -1, 0);
        cameraUp      = new Vector3(0, 0, 1);

        Camera.main.transform.position = new Vector3(cameraXPosition, cameraYPosition, cameraZPosition);
        Camera.main.transform.rotation = Quaternion.LookRotation(cameraForward, cameraUp);

        GridTile = Resources.Load("Prefab_GridTile") as GameObject;
        Grid     = new Script_Grid(this);


        Grid.InstantiateGrid(GridTile, 10, 10, _tileHeight, transform.rotation);
        GameObject sheep = Resources.Load("Prefab_Sheep") as GameObject;

        Grid.CreateSheep(sheep, 10, 10, 0, transform.rotation, 10);

        GameObject wolf = Resources.Load("Prefab_Wolf") as GameObject;

        Grid.CreateWolves(wolf, 10, 10, 0, transform.rotation, 3);
    }
Example #3
0
    void Start()
    {
        _isRunningSimulation = false;
        _entityList          = new List <Script_IEntity> ();

        cameraXPosition = width * 0.5f - tileSize * 0.5f;
        cameraZPosition = height * 0.5f - tileSize * 0.5f;
        cameraYPosition = 15.0f;

        cameraForward = new Vector3(0, -1, 0);
        cameraUp      = new Vector3(0, 0, 1);

        Camera.main.transform.position = new Vector3(cameraXPosition, cameraYPosition, cameraZPosition);
        Camera.main.transform.rotation = Quaternion.LookRotation(cameraForward, cameraUp);

        _grid = new Script_Grid(this);
        _grid.InstantiateGrid(10, 10, 0);

        InstantiateEntityAtRandomLocation <Script_TradingPost> ();
        InstantiateEntityAtRandomLocation <Script_FallenStar> ();
        InstantiateEntityAtRandomLocation <Script_SpaceShip> ();
        InstantiateEntityAtRandomLocation <Script_StarChaser>();

        _ui = new Script_UI(_grid, this);
    }