示例#1
0
    private void TryBuild()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (!Physics.Raycast(ray, out hit, Mathf.Infinity))
        {
            return;
        }

        if (ghostCollisionController.IsCollisionsFree())
        {
            if (GameStats.TryGetGold(currentBuildInfo.cost))
            {
                var towerSettings = ghostObject.GetComponent <ITower>();
                towerSettings.damage       = currentBuildInfo.damage;
                towerSettings.reloadTime   = currentBuildInfo.reloadTime;
                towerSettings.attackRadius = currentBuildInfo.attackRange;
                Destroy(ghostObject.GetComponent <GhostCollisionController>());
                towerSettings.SetState(true);

                SecretTowerContainer.AddTower(ghostObject);

                ghostObject = null;
            }
        }
    }
示例#2
0
    public override void Activate()
    {
        //GameStats.UpdateGoldCount(GameStats.mainConfig.startGoldAmount);
        //GameStats.UpdateLifeCount(GameStats.mainConfig.startLifeCount);
        //GameStats.level = 0;

        GameStats.Reset();
        SecretTowerContainer.ClearAll();

        onNewGameStart?.Invoke();
        //  EnemyWayPointManager.ClearDirectrly();

        mainGameStateMachine.ChangeState(mainGameStateMachine.levelState);
    }