Ejemplo n.º 1
0
        public IEnumerable <Match> GetMatchesByPlayerId(long id)
        {
            Player player = database.Players.Where(x => x.Id == id).FirstOrDefault();

            if (player == null)
            {
                try
                {
                    player = new PlayerTransformer(ExternalDataProvider.RequestsRepository.GetSummonerById(id.ToString())).Player;
                }
                catch (ResourceNotFoundException)
                {
                    throw new ElementNotFoundException();
                }
            }

            // Console.WriteLine("External api: GetMatchesByPlayerId");
            foreach (ExternalDataProvider.Entity.MatchJson matchData in ExternalDataProvider.RequestsRepository.GetMatchesByPlayerId(id.ToString()))
            {
                Match match = new MatchTransformer(matchData).Match;
                // Console.WriteLine("Match: " + match.ToString());
                if (!player.Matches.Any(x => x.Equals(match)))
                {
                    player.Matches.Add(match);
                }
            }

            player.lastExternalApiCall = DateTime.Now;

            return(player.Matches);
        }
Ejemplo n.º 2
0
        public Player GetPlayerByName(string name)
        {
            // Console.WriteLine("External api: GetSummonerByName");
            Player player;

            try
            {
                player = new PlayerTransformer(ExternalDataProvider.RequestsRepository.GetSummonerByName(name)).Player;
            }
            catch (ResourceNotFoundException)
            {
                throw new ElementNotFoundException();
            }

            database.Players.Add(player);

            return(player);
        }
Ejemplo n.º 3
0
 public void Start()
 {
     Cursor.lockState = CursorLockMode.Locked;
     playerModel      = new PlayerTransformer(GameObject.Find("Player"));
     cameraObject     = new CameraTransformer(GameObject.Find("Player Camera"));
 }
Ejemplo n.º 4
0
    void Awake()
    {
        this.transform.tag = Tags.PLAYER;

        _myPlatformerMovement = gameObject.AddComponent<PlatformerMovement>();

        _attackCatcher = gameObject.AddComponent<AttackCather> ();
        _clashAble = gameObject.AddComponent<ClashAble> ();
        _basicAttack = gameObject.AddComponent<BasicStunAttack> ();
        _playerTransformer = gameObject.AddComponent<PlayerTransformer> ();
        gameObject.AddComponent<TouchDetector2D> ();
        gameObject.AddComponent<LandOnTopKill> ();
        rigidBody = gameObject.GetComponent<Rigidbody2D> ();
        _playerAnimHandler = gameObject.AddComponent<PlayerAnimationHandler> ();
        gameObject.AddComponent<RigidbodyUtil2D>();

        _fader = gameObject.AddComponent<FadeInOut> ();

        gameObject.AddComponent<PlayerEffects>();
        gameObject.AddComponent<PlayerSoundHandler>();

        _stunTimer = gameObject.AddComponent<ComTimer> ();

        _stunTimer.TimerEnded += StunTimerEnded;

        _attackCatcher.OnStunAttackCatch += OnStunHit;
        _attackCatcher.OnStunKillAttackCatch += OnStunKillHit; // if Jump on my head hit while in stun
        _attackCatcher.OnKillAttackCatch += OnKillHit;
    }