private void Init()
    {
        if (MapTools.IsOutOfBounds(x, y))
        {
            return;
        }
        if (GameTools.Base.IsWithinBase(x, y))
        {
            return;
        }
        int tileTrapCount = GameTools.Map.TrapData[x, y].Count;

        if (tileTrapCount > 0)
        {
            if (GameTools.Map.TrapData[x, y][0].spell.SpellColour != this.spell.SpellColour)
            {
                for (int j = 0; j < tileTrapCount; j++)
                {
                    GameTools.Map.TrapData[x, y][j].Destroy();
                }
                GameTools.Map.TrapData[x, y] = new List <Trap>();
            }
        }
        this.count = GameTools.Map.TrapData[x, y].Count;
        GameTools.Map.TrapData[x, y].Add(this);

        InitGameObject();
        CleanTools.GetInstance().SubscribeCleanable(this);
    }
예제 #2
0
 public SpellIndicator(int maxPoolSize)
 {
     max_pool_size = maxPoolSize;
     initSpellIndicator();
     CleanTools.GetInstance().SubscribeCleanable(this, true);
     TilesToAnimate = new List <int>();
 }
예제 #3
0
    public CastRangeIndicator()
    {
        this.CoOrds          = new Dictionary <Pair, int>();
        this.Pool            = new List <GameObject>();
        this.ToggledEntities = new List <Entity>();

        CleanTools.GetInstance().SubscribeCleanable(this, true);
    }
 void actionLoseExit()
 {
     //Hide GUI
     CleanTools.GetInstance().CleanRemoveAll();
     turn_manager = null;
     player       = null;
     Base         = null;
     shop         = null;
     Debug.Log("actionLoseExit");
 }
예제 #5
0
    public EnemySpawner(int x, int y, int playerlevel, int difficultychange)
    {
        this.x                = x;
        this.y                = y;
        this.LevelSpawner     = playerlevel;
        this.difficultychange = difficultychange;

        MaxRechargeTime = 20 / playerlevel + 10;
        RechargeTime    = MaxRechargeTime;
        game_object     = Object.Instantiate(Resources.Load("Prefabs/TeleporterPrefab", typeof(GameObject))) as GameObject;
        game_object.transform.position = new Vector3(x, 0.01f, y);
        CleanTools.GetInstance().SubscribeCleanable(this);
    }
    public BonusTile(int x, int y)
    {
        hp          = Random.Range(1, 20);
        tick        = 1; //Random.Range(1, 3);
        amount      = (int)hp;
        MainColour  = ColourManager.getRandomColour();
        Interaction = TileInteraction.Stand;        //(TileInteraction)Random.Range (0, 2);
        Reward      = (TileReward)Random.Range(0, 2);

        this.x = x;
        this.y = y;

        CleanTools.GetInstance().SubscribeCleanable(this);
        InitGameObject();
    }
    void actionWinExit()
    {
        //Cleanup menu
        CleanTools.GetInstance().CleanRemoveLevel();

        //create new game instance
        float change_diff = (PlayerEndHP - PlayerStartHP) / PlayerStartHP * 10;

        change_diff += NumberOfWins;
        turn_manager = new GameInstance(player, Base, (int)change_diff);

        GoNextLevel = false;
        player.ReloadSpell();
        BattleLog.GetInstance().Restart();
        GameTools.GameCamera.MoveToCenter();
        PlayerStartHP = GameTools.Player.Health;
        Debug.Log("actionWinExit");
    }
예제 #8
0
    public GameInstance(Player player, PlayerBase Base, int adaptive_difficulty)
    {
        this.player           = player;
        this.Base             = Base;
        this.DifficultyChange = adaptive_difficulty;

        list_live_units = new List <Unit>();
        list_dead_units = new List <Unit>();
        all_units       = new List <Unit>();

        UnitCastIndicator = new CastRangeIndicator();

        initSM();
        initGame();
        GameTools.GI         = this;
        GameTools.All_Units  = list_live_units;
        GameTools.Dead_Units = list_dead_units;
        CleanTools.GetInstance().SubscribeCleanable(this);
    }
예제 #9
0
 public void init()
 {
     if (!hasInit)
     {
         map_unit_occupy = new Unit[size_x, size_z];
         TileMapData     = new TileType[size_x, size_z];
         WeightedMap     = new int[size_x, size_z];
         SpawnerMap      = new EnemySpawner[size_x, size_z];
         Spawners        = new List <EnemySpawner>();
         this.transform.Translate(0, 0, size_z);
         this.transform.Translate(-0.5f, 0f, -0.5f);
         GameTools.Map = this;
         CleanTools.GetInstance().SubscribeCleanable(this);
         hasInit = true;
         BuildMesh();
         GenerateBonusTiles();
         InitTrapMap();
     }
 }
 void actionTransitionClickedQuit()
 {
     CleanTools.GetInstance().CleanRemoveAll();
     turn_manager = null;
     player       = null;
 }
 protected override void InitCleanable()
 {
     CleanTools.GetInstance().SubscribeCleanable(this);
 }
 // Use this for initialization
 void Start()
 {
     _tileMap        = GetComponent <TileMap>();
     GameTools.Mouse = this;
     CleanTools.GetInstance().SubscribeCleanable(this);
 }
    private ProjectileManager()
    {
        init();

        CleanTools.GetInstance().SubscribeCleanable(this);
    }
예제 #14
0
 public Shop()
 {
     GameTools.Shop = this;
     CleanTools.GetInstance().SubscribeCleanable(this, true);
 }