Beispiel #1
0
 public Dispatcher(AgentMailQueueRepository agentMailQueueRepository,
                   DBMailQueueRepository dbMailQueueRepository,
                   MailDispatcher mailDispatcher,
                   AgentClientIdProvider agentClientIdProvider,
                   TicksProvider ticksProvider,
                   QuickTimer quickTimer)
 {
     _agentMailQueueRepository = agentMailQueueRepository;
     _dbMailQueueRepository    = dbMailQueueRepository;
     _mailDispatcher           = mailDispatcher;
     _agentClientIdProvider    = agentClientIdProvider;
     TicksProvider             = ticksProvider;
     QuickTimer = quickTimer;
 }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        timer        = new QuickTimer();
        pointers     = new List <Vector3>();
        maxIdleDelay = useOnlyMinIdle ? minIdleDelay : Random.Range(minIdleDelay, maxIdleDelay);
        m_nav        = gameObject.GetComponent <NavMeshAgent2D>();

        m_animator = gameObject.GetComponent <Animator>();

        //Initialize player reference
        var players = GameObject.FindGameObjectsWithTag("Player");

        if (players.Length > 1)
        {
            print("Error, more than one Player!");
        }
        else if (players.Length < 1)
        {
            print("Error, no Player!");
        }
        else
        {
            player = players[0];
        }

        //Initialize goals if necessary
        if (goals.Count == 0 || goals[0] == null)
        {
            var goalList = GameObject.FindGameObjectsWithTag("EnemyWaypoint");
            goals = new List <GameObject>(goalList);
        }

        alertSprite    = transform.Find("AlertSprite").gameObject;
        alert_animator = alertSprite.GetComponent <Animator>();

        vision = GetComponentInChildren <VisionCone>();
        vision.viewDistance = maxVisionDistance;
        vision.fov          = visionConeAngle * 2;

        Vector3 hearingCircleScale = transform.Find("VisionCircle").localScale;

        hearingCircleScale.x = 2f * maxHearingDistance;
        hearingCircleScale.y = 2f * maxHearingDistance;
        transform.Find("VisionCircle").localScale = hearingCircleScale;

        this.originalSpeed = m_nav.speed;
    }
Beispiel #3
0
    private void Start()
    {
        GameObject     player = GameObject.Find("Player");
        SpriteRenderer s_rend = GetComponent <SpriteRenderer>();

        s_rend.sortingOrder = transform.position.y > player.transform.position.y ? player.GetComponent <SpriteRenderer>().sortingOrder - 1 : player.GetComponent <SpriteRenderer>().sortingOrder + 1;
        timer = new QuickTimer();
        if (playerCoin)
        {
            player.SendMessage("CoinDropped", gameObject.transform);
        }
        else
        {
            GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
            foreach (GameObject e in enemies)
            {
                e.SendMessage("CoinDropped", gameObject.transform);
            }
        }
    }
Beispiel #4
0
    private void Start()
    {
        idleTimer = new QuickTimer();

        m_nav = gameObject.GetComponent <NavMeshAgent2D>();
        goals = new List <GameObject>();
        foreach (GameObject g in GameObject.FindGameObjectsWithTag("Treasure"))
        {
            goals.Add(g);
            print(g.name);
        }
        ChangePlayerState(PlayerStates.IDLE);
        m_animator = GetComponent <Animator>();

        coinLocations = new List <Transform>();

        GameObject gm = GameObject.FindGameObjectWithTag("Manager");

        gameManager = gm != null?gm.GetComponent <GameProgressTracker>() : null;

        if (gameManager != null)
        {
            if (gameManager.canReturn)
            {
                GameObject pos = GameObject.Find("ReturnPosition");
                m_nav.Warp(pos.transform.position);
                GameObject g = GameObject.Find("Exit");
                goals.Add(g);
                g.GetComponent <doorController>().enabled = true;
            }
        }

        a_source = gameObject.GetComponent <AudioSource>();

        this.originalSpeed = m_nav.speed;
    }