Ejemplo n.º 1
0
    public void setMembers(UnitType t, Team team, int n)
    {
        UIManagerBehaviour.boxSelectManager.allUnits.Add(this);
        type      = t;
        this.team = team;
        var g = Units.getUnit(t);

        for (int i = 0; i < n; i++)
        {
            GameObject go            = GameObject.Instantiate(g);
            var        unitBehaviour = go.GetComponent <UnitBehaviour>();
            unitBehaviour.setPlatoon(this);
            units.Add(unitBehaviour);
            //go.transform.parent = this.transform;
        }

        buildModules(t);
        if (t == UnitType.AFV)
        {
            var ghost = GhostPlatoonBehaviour.build(UnitType.Infantry, team, n);
            transporter.setTransported(ghost.getRealPlatoon());
            ghost.setOrientation(100 * Vector3.down, 0);
            ghost.setVisible(false);
        }
        movement.setDestination(Vector3.forward);
    }
    public static GhostPlatoonBehaviour build(UnitType t, Team currentTeam, int count)
    {
        var behaviour = GhostPlatoonBehaviour.build();

        behaviour.setMembers(t, currentTeam, count);
        return(behaviour);
    }
    public void buildUnit(UnitType t)
    {
        var behaviour = GhostPlatoonBehaviour.build(t, currentTeam, 4);

        addSpawn(behaviour);
    }