// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add authorization // services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) var config = ConfigurationFile.LoadConfiguration("config.json"); var api = new ScreenScraperAPI(config); var login = new LoginScreenScraper(api); var database = new Database(config); var manager = new ScrapManager(database); var scrap = new Thread(manager.StartScrap); Console.WriteLine("Starting scrap thread..."); scrap.Name = "ScrapThread"; scrap.Start(); var mvc = services.AddMvc(); mvc.AddXmlSerializerFormatters(); mvc.SetCompatibilityVersion(CompatibilityVersion.Version_2_2); services.AddSingleton(typeof(ILoginLogic), login); services.AddSingleton(typeof(IDatabase), database); services.AddSingleton(typeof(IScrapManager), manager); services.AddSingleton(typeof(IScreenScraperAPI), api); services.AddSwaggerDocument(); }
// Start is called before the first frame update void Start() { health = GetComponent <Health>(); health.onDie += OnDie; manager = FindObjectOfType <ScrapManager>(); }
// Use this for initialization void Start() { // 초기 상태 지정 state = AiState.Finding; astarAI = GetComponent <IAstarAI>(); scrapManager = FindObjectOfType <ScrapManager>(); animation = GetComponent <EmployeeAnimation>(); }
public AdministrationController(IDatabase db, IScrapManager manager, ILogger <AdministrationController> logger, IScreenScraperAPI api, IConfigurationFile config) { _db = (Database)db; _manager = (ScrapManager)manager; _api = (ScreenScraperAPI)api; _logger = logger; _config = config; }
// Start is called before the first frame update void Start() { interactable = GetComponent <Interactable>(); interactable.onInteract += OpenShop; interactable.onExit += ExitShop; manager = FindObjectOfType <ScrapManager>(); shopUI.SetActive(false); }
// Use this for initialization void Start() { //Ger variables dess värde, skapar rätt referenser path = new UnityEngine.AI.NavMeshPath(); start = GameObject.Find("SpawnPoint"); target = GameObject.Find("FinishPoint"); gameManager = GameObject.Find("GameManager"); scrapManager = gameManager.GetComponent <ScrapManager>(); NavMesh.CalculatePath(start.transform.position, target.transform.position, NavMesh.AllAreas, path); }
void Update() { medEnemies = GameObject.FindGameObjectsWithTag("Enemy"); smallEnemies = GameObject.FindGameObjectsWithTag("SmallEnemy"); bigEnemies = GameObject.FindGameObjectsWithTag("BigEnemy"); if (Input.GetKeyDown(KeyCode.Space)) { isActive = !isActive; ScrapMan = GameObject.Find("scrapCountLabel").GetComponent<ScrapManager>(); if (ScrapMan.Scrap < scrapCost) return; else ScrapMan.Scrap -= scrapCost; } if (isActive) { hasSpawned = true; if (timer <= maxSizeTime) { radius += sizeInc * Time.deltaTime; if (radius >= maxRadius) { timer += Time.deltaTime; } } if (timer >= maxSizeTime) { radius -= sizeDec * Time.deltaTime; if (radius < 0) { radius = 0; isActive = false; timer = 0.0f; } } foreach (GameObject enemy in medEnemies) { Vector3 toRepel = transform.position - enemy.transform.position; Debug.DrawLine(transform.position, enemy.transform.position); if(toRepel.sqrMagnitude <= radius * radius) { enemy.GetComponent<MediumEnemy>().SetRepelStateOn(); } } foreach (GameObject enemy in smallEnemies) { Vector3 toRepel = transform.position - enemy.transform.position; Debug.DrawLine(transform.position, enemy.transform.position); if (toRepel.sqrMagnitude <= radius * radius) { enemy.GetComponent<SmallEnemy>().SetRepelStateOn(); } } foreach (GameObject enemy in bigEnemies) { Vector3 toRepel = transform.position - enemy.transform.position; Debug.DrawLine(transform.position, enemy.transform.position); if (toRepel.sqrMagnitude <= radius * radius) { enemy.GetComponent<BigEnemy>().SetRepelStateOn(); } } } else { if (hasSpawned && timer == 0) Destroy(gameObject); } }
private void Awake() { sm_single = this; currentScrap = 0; }
void Start() { posOffset = transform.position - targetToProtect.position; Damage = 5f; FireRate = 2f; Range = 15f; ScrapMan = GameObject.Find("scrapCountLabel").GetComponent<ScrapManager>(); }
public GameController(IDatabase db, IScrapManager manager, IScreenScraperAPI api) { _db = (Database)db; _manager = (ScrapManager)manager; _api = (ScreenScraperAPI)api; }