Esempio n. 1
0
    private void SetMassTwoTeamsArcher()
    {
        OldScenario = ScenarioTypes.MassTwoTeams;

        var formation = Formations.SquareFormation(MassSize, PlayerPosition);

        for (int i = 0; i < MassSize; i++)
        {
            var entity = i > MassSize * 0.25f
                    ? factory.CreateKnight(formation[i], Rotation())
                    : factory.CreateArcher(formation[i], Rotation());

            Selection.Instance.Selectables.Add(entity);
        }

        formation = Formations.SquareFormation(MassSize, CPUPosition);

        for (int i = 0; i < MassSize; i++)
        {
            var entity = i > MassSize * 0.75f
                    ? factory.CreateArcher(formation[i], Rotation(), true)
                    : factory.CreateKnight(formation[i], Rotation(), true);

            Selection.Instance.Selectables.Add(entity);
        }
    }
Esempio n. 2
0
    private void SetMassTwoTeams()
    {
        OldScenario = ScenarioTypes.MassTwoTeams;

        // var formation = Formations.SquareFormation(MassSize, PlayerPosition);

        Selection.Instance.Selectables = Formations.SquareFormation(MassSize, PlayerPosition)
                                         .Select(i => factory.CreateKnight(i, Rotation()))
                                         .ToHashSet();

        Selection.Instance.Selectables.AddRange(
            Formations.SquareFormation(MassSize, PlayerPosition)
            .Select(i => factory.CreateKnight(i, Rotation()))
            .ToHashSet()
            );
    }
Esempio n. 3
0
    /*------------------------------------------------------------------*\
    |*							IEntity implementation
    \*------------------------------------------------------------------*/


    public void SetDestination(Vector3 position)
    {
        if (Entities.Count == 1)
        {
            Entities.First().SetDestination(position);
        }
        else
        {
            var offsets = Formations.SquareFormation(Entities.Count, position, Offset);
            Entities.Zip(offsets, Tuple.Create).ForEach(i => i.Item1.SetDestination(i.Item2));
        }

        if (Entities.Count > 3)
        {
            Entities.ForEach(e => e.Agent.stoppingDistance = 1f);
        }
    }