Esempio n. 1
0
 public IEnumerable <Item> AllInventories(string owner)
 {
     return(AllItems(owner)
            .Select(x => x.GetComponent <Entity>())
            .Where(x => x != null)
            .Aggregate(FList.Create <Item>(), (a, x) => a + x.items));
 }
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Space))
        {
            replace.GetComponentInChildren <ParticleSystem>().Stop();

            GetComponentInChildren <ParticleSystem>().Play();

            _currentSpeed = speed;
            _timer        = timeToExplode;

            transform.position = _startPos;

            _allParticles.Select(x => x.main).Aggregate(FList.Create <ParticleSystem.MainModule>(), (acum, current) =>
            {
                current.loop = true;
                return(acum + current);
            });
        }

        _timer -= Time.deltaTime;

        if (_timer <= 0.0f)
        {
            GetComponentInChildren <ParticleSystem>().Stop();
        }

        transform.position += transform.forward * _currentSpeed * Time.deltaTime;
    }
Esempio n. 3
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex)
 {
     _playerBodies = FList.Create <Tuple <Player, Rigidbody> >();
     foreach (var item in GameManager.Instance.Players)
     {
         var rb = item.GetComponent <Rigidbody>();
         _playerBodies += Tuple.Create(item, rb);
         rb.velocity    = Vector3.zero;
     }
 }
Esempio n. 4
0
    public void tuhermana()
    {
        List <string> ColeccionDeHabitaciones = new List <string>();

        var sarasas = FList.Create <Tuple <string, int> >();

        FList <Tuple <string, int> > sarasa = ColeccionDeHabitaciones.Aggregate(sarasas, (acum, current) =>
        {
            acum += Tuple.Create(current, 5);
            return(acum);
        });
    }
Esempio n. 5
0
    void Start()
    {
        Batch();
        var ans   = GetComponentsInChildren <Animator>(true).Select(x => x.gameObject).ToFList();
        var flist = FList.Create <GameObject>();

        foreach (var item in ans)
        {
            var l = item.GetComponentsInChildren <Transform>(true).Select(x => x.gameObject);
            flist += l;
        }
        flist += ans;
        _destructibleProps = flist.ToArray();

        //EventManager.Instance.AddEventListener(CrystalPyramidEvents.DestructibleWallDestroyEnd, OnDestroyAnimationEnd);
    }
Esempio n. 6
0
 public IEnumerable <Item> AllItems(string owner)
 {
     return(AllMapNodes(owner).Aggregate(FList.Create <Item>(), (a, wp) => a += wp.nearbyItems));
 }
 //This isn't semantically correct, but it's cleaner to read.
 public static FList <T> operator+(T lhs, FList <T> rhs)
 {
     return(FList.Create(lhs) + rhs);
 }
 //This isn't semantically correct, but it's cleaner to read.
 public static FList <T> operator+(FList <T> lhs, T rhs)
 {
     return(lhs + FList.Create(rhs));
 }
Esempio n. 9
0
    void LoadPlayers()
    {
        var playerInfo = Serializacion.LoadJsonFromDisk <RegisteredPlayers>("Registered Players");
        var playerControllersOrdered = playerInfo.playerControllers.OrderByDescending(x => playerInfo.playerStats[Array.IndexOf(playerInfo.playerControllers, x)].Score).ToArray();
        var playerScoresOrdered      = playerInfo.playerStats.OrderByDescending(y => y.Score).ToArray();

        _players = new GameObject[playerControllersOrdered.Length];

        for (int i = 0; i < playerControllersOrdered.Length; i++)
        {
            var URLs = Serializacion.LoadJsonFromDisk <CharacterURLs>("Player " + (playerControllersOrdered[i] + 1));

            //Dejo los objetos como children del body por cuestiones de carga de los scripts. Assembler no debería generar problemas, ya que su parent objetivo sería el mismo.
            var player = Instantiate(Resources.Load <GameObject>("Prefabs/CharacterSelection/Bodies/" + URLs.bodyURL), spawnPos[i].position, Quaternion.identity);
            var weapon = Instantiate(Resources.Load <GameObject>("Prefabs/CharacterSelection/Weapons/" + URLs.weaponURL), player.transform.position, Quaternion.identity, player.transform);
            var comp1  = Instantiate(Resources.Load <GameObject>("Prefabs/CharacterSelection/Skills/Complementary/" + URLs.complementaryURL[0]), player.transform.position, Quaternion.identity, player.transform);
            var comp2  = Instantiate(Resources.Load <GameObject>("Prefabs/CharacterSelection/Skills/Complementary/" + URLs.complementaryURL[1]), player.transform.position, Quaternion.identity, player.transform);
            var def    = Instantiate(Resources.Load <GameObject>("Prefabs/CharacterSelection/Skills/Defensive/" + URLs.defensiveURL), player.transform.position, Quaternion.identity, player.transform);
            var tx     = Instantiate(playerText, player.transform.position, Quaternion.identity, player.transform);

            tx.transform.Rotate(transform.up, 180);

            CharacterAssembler.Assemble(player.gameObject, def, comp1, comp2, weapon);

            player.gameObject.layer = LayerMask.NameToLayer("Player" + (playerControllersOrdered[i] + 1));
            player.gameObject.tag   = "Player " + (playerControllersOrdered[i] + 1);
            foreach (Transform t in player.transform)
            {
                t.gameObject.layer = LayerMask.NameToLayer("Player" + (playerControllersOrdered[i] + 1));
                t.gameObject.tag   = "Player " + (playerControllersOrdered[i] + 1);
            }

            tx.gameObject.layer      = LayerMask.NameToLayer("P1ONLY");
            player.transform.forward = spawnPos[i].forward;
            _players[i] = player;
        }

        _winner = _players.First();

        var l = _players.Length;

        _resetInputs     = new bool[l];
        playerIndexes    = new PlayerIndex[l];
        previousGamePads = new GamePadState[l];
        currentGamePads  = new GamePadState[l];
        for (int i = 0; i < currentGamePads.Length; i++)
        {
            playerIndexes[i]   = (PlayerIndex)playerControllersOrdered[i];
            currentGamePads[i] = GamePad.GetState(playerIndexes[i]);
        }

        for (int i = 0; i < _players.Length; i++)
        {
            var score = playerScoresOrdered[i].Score;
            EndgamePlayerText(_players[i], _players[i].gameObject.tag, score.ToString(), i);
            _resetInputs[i] = false;
        }

        //award, award amount, player, desc
        var awards = FList.Create(Tuple.Create("", 0f, 0, ""));

        mostKills = playerInfo.playerControllers.OrderByDescending(x => playerInfo.playerStats[Array.IndexOf(playerInfo.playerControllers, x)].Kills).First();
        var killAmount = playerInfo.playerStats.OrderByDescending(y => y.Kills).First().Kills;

        awards += Tuple.Create("Most Kills", (float)killAmount, Array.IndexOf(playerControllersOrdered, mostKills), " kills");

        mostSurvived = playerInfo.playerControllers.OrderByDescending(x => playerInfo.playerStats[Array.IndexOf(playerInfo.playerControllers, x)].Survived).First();
        var survivedAmount = playerInfo.playerStats.OrderByDescending(y => y.Survived).First().Survived;

        awards += Tuple.Create("Most Survived", (float)survivedAmount, Array.IndexOf(playerControllersOrdered, mostSurvived), "survived");

        mostDamageDealt = playerInfo.playerControllers.OrderByDescending(x => playerInfo.playerStats[Array.IndexOf(playerInfo.playerControllers, x)].DamageDealt).First();
        var damageDealtAmount = playerInfo.playerStats.OrderByDescending(y => y.DamageDealt).First().DamageDealt;

        awards += Tuple.Create("Most Damage Dealt", damageDealtAmount, Array.IndexOf(playerControllersOrdered, mostDamageDealt), " dmg dealt");

        leastDamageTaken = playerInfo.playerControllers.OrderBy(x => playerInfo.playerStats[Array.IndexOf(playerInfo.playerControllers, x)].DamageTaken).First();
        var damageTakenAmount = playerInfo.playerStats.OrderBy(y => y.DamageTaken).First().DamageTaken;

        awards += Tuple.Create("Bulletproof", damageTakenAmount, Array.IndexOf(playerControllersOrdered, leastDamageTaken), " dmg taken");

        print("Psycho Killer Award goes to: Player " + (mostKills + 1) + " with " + killAmount + " kills");
        print("Survivor Award goes to: Player " + (mostSurvived + 1) + " with " + survivedAmount + " rounds survived");
        print("Dealer Award goes to: Player " + (mostDamageDealt + 1) + " with " + damageDealtAmount + " damage dealt");
        print("Bulletproof Award goes to: Player " + (leastDamageTaken + 1) + " with " + damageTakenAmount + " damage taken");

        for (int i = 0; i < playerScoresOrdered.Length; i++)
        {
            var playList = awards.Skip(1).Where(x => x.Item3 == i).ToList();
            if (playList.Any())
            {
                foreach (var item in playList)
                {
                    SetAwardsOnPedestal(item);
                }
            }
        }

        HideUnusedPedestals();
    }