Esempio n. 1
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Formations.Clear();
                var items = await DataStore.RefreshDataAsync();

                foreach (var item in items)
                {
                    Formations.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 2
0
        private void ProcessOrder(OrderData orderData)
        {
            switch (orderData.OrderType)
            {
            case OrderType.MOVE_ORDER:
                List <Vector3> destinations = Formations.GetLineFormation(
                    orderData.TargetPosition, orderData.Heading, orderData.Platoon.Units.Count);

                for (int i = 0; i < orderData.Platoon.Units.Count; i++)
                {
                    orderData.Platoon.Units[i]
                    .SetDestination(destinations[i], orderData.Heading, orderData.MoveCommandType);
                }

                return;

            case OrderType.FIRE_POSITION_ORDER:
                orderData.Platoon.Units
                .ForEach(u => u.SendFirePosOrder(orderData.TargetPosition));
                orderData.Platoon.PlayAttackCommandVoiceline();

                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Activates all units, moving from ghost/preview mode to a real platoon.
        /// </summary>
        /// <param name="spawnCenter"></param>
        private void Activate(Vector3 spawnCenter)
        {
            Units.ForEach(x =>
            {
                x.GameObject.SetActive(true);
                //Networking.CommandConnection.Connection.CmdSpawnObject(x.GameObject);
            });

            _platoonLabel.AssociateToRealUnits(Units);

            IsInitialized = true;

            transform.position = spawnCenter;

            List <Vector3> positions = Formations.GetLineFormation(
                spawnCenter, GhostPlatoon.FinalHeading, Units.Count);

            Units.ForEach(u => u.WakeUp());
            for (int i = 0; i < Units.Count; i++)
            {
                Units[i].Teleport(
                    positions[i], GhostPlatoon.FinalHeading - Mathf.PI / 2);
            }

            OrderMovement(
                GhostPlatoon.transform.position,
                GhostPlatoon.FinalHeading,
                MoveCommandType.FAST);
            GhostPlatoon.SetVisible(false);

            MatchSession.Current.RegisterPlatoonBirth(this);
        }
Esempio n. 4
0
        /* isp ActivateFormation()
         *
         * Input variables:
         * battleFormation =
         * battleFormationType =
         *
         * State variables:
         *
         *
         */
        public void ActivateFormation(BattleFormation battleFormation, BattleFormationType battleFormationType)
        {
            if (battleFormation is null)
            {
                throw new ArgumentNullException(nameof(BattleFormation));
            }
            if (battleFormation.GeneralInCharge == null)
            {
                var article = battleFormationType == BattleFormationType.Offensive ? "an" : "a";
                throw new InvalidOperationException($"A general must be assigned in charge of {battleFormation.Name} formation in your '{Name}' planet to activate it as {article} {battleFormationType.ToString().ToLower()} formation");
            }
            var formation = Formations.SingleOrDefault(f => f.Equals(battleFormation));

            if (formation == null)
            {
                throw new ArgumentException("Formation does not exist");
            }
            if (battleFormationType == BattleFormationType.Offensive)
            {
                battleFormation.SetStatus(true);
                ActiveOffensiveFormation = battleFormation;
            }

            if (battleFormationType == BattleFormationType.Defensive)
            {
                battleFormation.SetStatus(true);
                ActiveDefensiveFormation = battleFormation;
            }
        }
Esempio n. 5
0
    public FormationStats(
        float SQUAD_ADDITIONAL_SPEED,
        float SQUAD_ADDITIONAL_ROTATION_SPEED,
        float UNIT_ADDITIONAL_SPEED,
        float UNIT_ADDITIONAL_ROTATION_SPEED,
        float UNIT_ADDITIONAL_DAMAGE,
        float UNIT_ADDITIONAL_ATTACK,
        float UNIT_ADDITIONAL_DEFENCE,
        float UNIT_ADDITIONAL_DEFENCE_SECTOR,
        float UNIT_CHARGE_IMPACT,
        float UNIT_CHARGE_DEFLECT,
        float COOLDOWN,
        Formations FORMATION
        )
    {
        this.SQUAD_ADDITIONAL_SPEED          = SQUAD_ADDITIONAL_SPEED;
        this.SQUAD_ADDITIONAL_ROTATION_SPEED = SQUAD_ADDITIONAL_ROTATION_SPEED;

        this.UNIT_ADDITIONAL_SPEED          = UNIT_ADDITIONAL_SPEED;
        this.UNIT_ADDITIONAL_ROTATION_SPEED = UNIT_ADDITIONAL_ROTATION_SPEED;

        this.UNIT_ADDITIONAL_DAMAGE = UNIT_ADDITIONAL_DAMAGE;

        this.UNIT_ADDITIONAL_ATTACK  = UNIT_ADDITIONAL_ATTACK;
        this.UNIT_ADDITIONAL_DEFENCE = UNIT_ADDITIONAL_DEFENCE;

        this.UNIT_ADDITIONAL_DEFENCE_SECTOR = UNIT_ADDITIONAL_DEFENCE_SECTOR;

        this.UNIT_CHARGE_IMPACT  = UNIT_CHARGE_IMPACT;
        this.UNIT_CHARGE_DEFLECT = UNIT_CHARGE_DEFLECT;

        this.COOLDOWN = COOLDOWN;

        this.FORMATION = FORMATION;
    }
Esempio n. 6
0
        private void PositionGhostUnits(Vector3 facingPoint, bool makeVisible)
        {
            Vector3 diff    = facingPoint - _previewPosition;
            float   heading = diff.getRadianAngle();

            /*Vector3 forward = new Vector3(Mathf.Cos(heading), 0, Mathf.Sin(heading));
             * int formationWidth = _selection.Count;// Mathf.CeilToInt(2 * Mathf.Sqrt(spawnList.Count));
             * float platoonDistance = 4 * PlatoonBehaviour.UNIT_DISTANCE;
             * var right = Vector3.Cross(forward, Vector3.up);
             * var pos = _previewPosition + platoonDistance * (formationWidth - 1) * right / 2f;*/

            List <Vector3> positions = Formations.GetLineFormation(
                _previewPosition, heading + Mathf.PI / 2, _selection.Count);
            List <GhostPlatoonBehaviour> ghosts = _selection.ConvertAll(
                x => x.GhostPlatoon);

            for (int i = 0; i < _selection.Count; i++)
            {
                ghosts[i].SetPositionAndOrientation(positions[i], heading);
            }

            if (makeVisible)
            {
                ghosts.ForEach(x => x.SetVisible(true));
            }
        }
Esempio n. 7
0
    /// <summary>
    /// Gets EnemySpawner Formation Script object for positioning each enemy.
    /// </summary>
    /// <param name="form"></param>
    /// <returns></returns>
    public static EnemySpawner GetFormationScript(Formations form)
    {
        EnemySpawner formSpawn = GameObject.FindGameObjectWithTag("phase1").GetComponent <EnemySpawner>();

        switch (form)
        {
        case Formations.Round1Phase1:
            //formSpawn = GameObject.FindGameObjectWithTag("phase1").GetComponent<EnemySpawner>();
            break;

        case Formations.Round1Phase2:
            formSpawn = GameObject.FindGameObjectWithTag("phase2").GetComponent <EnemySpawner>();
            break;

        case Formations.Round1Phase3:
            formSpawn = GameObject.FindGameObjectWithTag("phase31").GetComponent <EnemySpawner>();
            break;

        case Formations.Round1Phase4:
            formSpawn = GameObject.FindGameObjectWithTag("phase41").GetComponent <EnemySpawner>();
            break;

        case Formations.Round1Phase5:
            formSpawn = GameObject.FindGameObjectWithTag("phase51").GetComponent <EnemySpawner>();
            break;
        }
        return(formSpawn);
    }
        private Formations initializeFormation(decimal id)
        {
            // recupération de l'organisme auquel sera rattaché notre nouvelle formation
            Organismes orga = TempData["model"] as Organismes;
            // récupération du responsable pour le préremplir comme responsable pédagogique
            Responsable rp = db.Responsable.Find(((Responsable)Session["Responsable"]).Id);

            Formations formation = new Formations();

            formation.TypedeFormationsId = id;
            formation.OrganismeId        = orga.Id;

            formation.Habilitations = new Habilitations();

            Personnel pers = new Personnel();

            pers.Nom       = rp.Nom;
            pers.Prenom    = rp.Prenom;
            pers.Email     = rp.Email;
            pers.Telephone = rp.Telephone;

            formation.Personnel = pers;

            return(formation);
        }
Esempio n. 9
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. 10
0
 public void WriteToROM()
 {
     if (NewGame != null && NewGame.Visible)
     {
         NewGame.WriteToROM();
     }
     if (Animations != null && Animations.Visible)
     {
         Animations.WriteToROM();
     }
     if (Attacks != null && Attacks.Visible)
     {
         Attacks.WriteToROM();
     }
     if (Battlefields != null && Battlefields.Visible)
     {
         Battlefields.WriteToROM();
     }
     if (Dialogues != null && Dialogues.Visible)
     {
         Dialogues.WriteToROM();
     }
     if (EventScripts != null && EventScripts.Visible)
     {
         EventScripts.WriteToROM();
     }
     if (Fonts != null && Fonts.Visible)
     {
         Fonts.WriteToROM();
     }
     if (Formations != null && Formations.Visible)
     {
         Formations.WriteToROM();
     }
     if (Items != null && Items.Visible)
     {
         Items.WriteToROM();
     }
     if (Areas != null && Areas.Visible)
     {
         Areas.WriteToROM();
     }
     if (Monsters != null && Monsters.Visible)
     {
         Monsters.WriteToROM();
     }
     if (Sprites != null && Sprites.Visible)
     {
         Sprites.WriteToROM();
     }
     if (Intro != null && Intro.Visible)
     {
         Intro.WriteToROM();
     }
     if (WorldMaps != null && WorldMaps.Visible)
     {
         WorldMaps.WriteToROM();
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Clears out both Enemy object list and Enemy Path Params list.
 /// </summary>
 public static void RemovePaths()
 {
     isWaveOneStarted = false;
     enemyObjects.Clear();
     EnemyPathParams.Clear();
     Debug.Log("<color=red>ENEMY OBJECTS CLEARED</color>");
     CurrentRoundPhase += 1;
 }
Esempio n. 12
0
 public CandidatFormationViewModel()
 {
     Tuteur       = new Tuteurs();
     Candidat     = new CandidatsFormations();
     Formation    = new Formations();
     Sexe         = new Sexes();
     Financements = new List <TypedeFinancements>();
 }
Esempio n. 13
0
        /* isp AddFormation()
         *
         * Input variables:
         * battleFormation =
         *
         * State variables:
         *
         *
         */

        public void AddFormation(BattleFormation battleFormation)
        {
            if (battleFormation is null)
            {
                throw new ArgumentNullException(nameof(BattleFormation));
            }
            Formations?.Add(battleFormation);
        }
Esempio n. 14
0
    public override void ProcessWaypoint()
    {
        var destinations = Formations.GetLineFormation(Destination, Heading, platoon.Units.Count);

        platoon.Units.ForEach(x => x.SetUnitDestination(this));
        //platoon.Units.ConvertAll(x => x as Matchable<Vector3>).Match(destinations);
        //platoon.Units.ForEach(x => x.SetUnitFinalHeading(Heading));
    }
Esempio n. 15
0
 /* isp ExistsFormation()
  *
  * Input variables:
  * battleFormation =
  *
  * State variables:
  *
  *
  */
 public bool ExistsFormation(BattleFormation battleFormation)
 {
     if (battleFormation is null)
     {
         throw new ArgumentNullException(nameof(BattleFormation));
     }
     return(Formations?.SingleOrDefault(f => f.Equals(battleFormation)) != null);
 }
Esempio n. 16
0
        public Formation GetFormation(string id)
        {
            if (!Formations.ContainsKey(id))
            {
                throw new GameDataException("Could not find formation with id " + id);
            }

            return(Formations[id]);
        }
        public ActionResult ShowASAC(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Formations formation = db.Formations.Find(id);

            return(View(formation));
        }
Esempio n. 18
0
        private void UpdateGhostLocations()
        {
            List <Vector3> positions = Formations.GetLineFormation(
                transform.position, FinalHeading, _units.Count);

            for (int i = 0; i < _units.Count; i++)
            {
                _units[i].GetComponent <MovementComponent>()
                .Teleport(positions[i], Mathf.PI / 2 - FinalHeading);
            }
        }
Esempio n. 19
0
 // Update is called once per frame
 void Update()
 {
     foreach (Vector3 point in Formations.GetPolygonFormation(leader.position, center.position, normal.position - center.position, numberOfSides, amount))
     {
         Debug.DrawLine(center.position, point, Color.red);
     }
     foreach (Vector3 point in Formations.GetCircleFormation(leader.position, center.position, normal.position - center.position, amount))
     {
         Debug.DrawLine(center.position, point, Color.blue);
     }
 }
        public ActionResult DeleteFormation(decimal id)
        {
            Formations f      = db.Formations.Find(id);
            var        orga   = f.OrganismeId;
            int        typeFo = (int)f.TypedeFormationsId;
            string     method = "";

            db.DescriptifUC.RemoveRange(f.DescriptifUC);
            db.CandidatsFormations.RemoveRange(f.CandidatsFormations);



            db.Formations.Remove(f);
            switch (typeFo)
            {
            case 1:
                method = "EtatFormationAC";
                break;

            case 2:
                method = "EtatFormationAS";
                break;

            case 3:
                method = "EtatFormationCFEB";
                break;

            case 4:
                method = "EtatFormationCQP";
                break;

            case 5:
                method = "EtatFormationBPJEPS";
                break;

            case 6:
                method = "EtatFormationDEJEPS";
                break;

            default:
                method = "EtatFormationDESJEPS";
                break;
            }
            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
            }

            return(RedirectToAction(method, "AccesResponsable", new { id = orga }));
        }
Esempio n. 21
0
        public Formations AddNewFormation(Formations formation)
        {
            var sql = @"insert into Formations(Name,FormationImg)
                            output inserted.*
                            values(@Name,@FormationImg)";

            using (var db = new SqlConnection(ConnectionString))
            {
                var result = db.QueryFirstOrDefault <Formations>(sql, formation);
                return(result);
            }
        }
Esempio n. 22
0
    public void SetOrientation(Vector3 center, float heading)
    {
        FinalHeading       = heading;
        transform.position = center;

        var positions = Formations.GetLineFormation(center, heading, _units.Count);

        for (int i = 0; i < _units.Count; i++)
        {
            _units[i].GetComponent <UnitBehaviour>().SetOriginalOrientation(positions[i], Mathf.PI / 2 - heading, false);
        }
    }
Esempio n. 23
0
        // Places the ghost units (unit silhouettes) in view of the player:
        public void PreviewPurchase(Vector3 center, Vector3 facingPoint)
        {
            Vector3 diff    = facingPoint - center;
            float   heading = diff.getRadianAngle();

            var positions = Formations.GetLineFormation(center, heading + Mathf.PI / 2, GhostPlatoons.Count);

            for (var i = 0; i < GhostPlatoons.Count; i++)
            {
                GhostPlatoons[i].SetOrientation(positions[i], heading);
            }
        }
Esempio n. 24
0
        public void SetPositionAndOrientation(Vector3 center, float heading)
        {
            FinalHeading       = heading;
            transform.position = center;

            List <Vector3> positions = Formations.GetLineFormation(center, heading, _units.Count);

            for (int i = 0; i < _units.Count; i++)
            {
                _units[i].GetComponent <MovementComponent>()
                .Teleport(positions[i], Mathf.PI / 2 - heading);
            }
        }
Esempio n. 25
0
        //GET FORMATION BY ID
        public Formations GetFormationById(int id)
        {
            var formation = new Formations();
            var sql       = @"select *
                         from Formations
                            where Id = @id";

            using (var db = new SqlConnection(ConnectionString))
            {
                var parameters = new { Id = id };
                formation = db.QueryFirstOrDefault <Formations>(sql, parameters);
            }
            return(formation);
        }
Esempio n. 26
0
        /// <summary>
        /// Places the ghost units (unit silhouettes) in view of the player.
        /// </summary>
        /// <param name="center"></param>
        /// <param name="facingPoint"></param>
        public void PreviewPurchase(Vector3 center, Vector3 facingPoint)
        {
            Vector3 diff    = facingPoint - center;
            float   heading = diff.getRadianAngle();

            List <Vector3> positions = Formations.GetLineFormation(
                center, heading + Mathf.PI / 2, PreviewPlatoons.Count);

            for (int i = 0; i < PreviewPlatoons.Count; i++)
            {
                PreviewPlatoons[i].SetGhostOrientation(positions[i], heading);
                PreviewPlatoons[i].ToggleGhostVisibility(true);
            }
        }
        public ActionResult AddSimpleFormation(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TypedeFormations type = db.TypedeFormations.Find(id);

            ViewBag.Libelle = type.Libelle;

            Formations formation = initializeFormation(id);

            return(View(formation));
        }
        public ActionResult AddSimpleFormation(Formations formation)
        {
            if (ModelState.IsValidField("DateDebut") && ModelState.IsValidField("DateFin") && ModelState.IsValidField("DateLimiteInscription") && ModelState.IsValidField("DateTestSelection") &&
                ModelState.IsValidField("NombreTotalHeures") && ModelState.IsValidField("NbreHeureCentre") && ModelState.IsValidField("NbrHeureStructAccueil") &&
                ModelState.IsValidField("TotalHeureFOAD") && ModelState.IsValidField("HeureELearning") && ModelState.IsValidField("TotalAutresHeures") &&
                ModelState.IsValidField("TypeHeureContenu") && ModelState.IsValidField("CoutComplet") && ModelState.IsValidField("NbreHeureAutreEspace") &&
                ModelState.IsValidField("Personnel.Nom") && ModelState.IsValidField("Personnel.Prenom") && ModelState.IsValidField("Personnel.Email") && ModelState.IsValidField("Personnel.Telephone") &&
                ModelState.IsValidField("Lieux.Ville") && ModelState.IsValidField("Lieux.Adresse") && ModelState.IsValidField("Lieux.CodePostal") &&
                ModelState.IsValidField("Habilitations.NumeroHabilitation") && ModelState.IsValidField("Habilitations.DebutDateDelivrance") && ModelState.IsValidField("Habilitations.FinDateDelivrance") && ModelState.IsValidField("Habilitations.NumeroSession") && ModelState.IsValidField("Habilitations.DateEPMSP") && ModelState.IsValidField("Habilitations.DateTEP")
                )
            {
                // Mise en place de l'organisateur pédagogique
                Personnel p = new Personnel();
                p.Nom       = formation.Personnel.Nom;
                p.Prenom    = formation.Personnel.Prenom;
                p.Email     = formation.Personnel.Email;
                p.Telephone = formation.Personnel.Telephone;

                Lieux l = new Lieux();
                l.Email      = formation.Lieux?.Email;
                l.Adresse    = formation.Lieux.Adresse;
                l.CodePostal = formation.Lieux.CodePostal;
                l.Ville      = formation.Lieux.Ville;
                l.Telephone  = formation.Lieux.Telephone;

                formation.LieuSiNonPorteuse  = l.Id;
                formation.IdOrganisateurpeda = formation.Personnel.Id;
                formation.FormationEnded     = false;

                db.Lieux.Add(l);
                db.Personnel.Add(p);
                db.Formations.Add(formation);
                if (formation.Habilitations != null)
                {
                    db.Habilitations.Add(formation.Habilitations);
                }
                try { db.SaveChanges(); }
                catch (Exception e)
                {
                }


                return(backToGoodFormation((decimal)formation.OrganismeId, (decimal)formation.TypedeFormationsId));
            }
            TypedeFormations type = db.TypedeFormations.Find(formation.TypedeFormationsId);

            ViewBag.Libelle = type.Libelle;
            return(View(formation));
        }
Esempio n. 29
0
    void Awake()
    {
        Fsm = new StateMachine <Enemy>(this);
        State <Enemy> state;

        switch (this.startState)
        {
        case StartState.Wander:
            state = new DumbWanderState(this, Fsm, 30.0f);
            break;

        case StartState.ReachGoal:
            state = new ReachGoalState(this, Fsm, target);
            break;

        default:
            state = new DumbWanderState(this, Fsm, 30.0f);
            break;
        }
        Fsm.InitialState(state);

        GroupPositions = new List <GameObject>(GroupMembers.Count);
        switch (this.formation)
        {
        case Formation.V:
            generatePositions(Formations.GetVFormation(this.transform.position, spread, GroupMembers.Count));
            break;

        case Formation.Circle:
            generatePositions(Formations.GetCircleFormation(this.transform.position + spread * (new Vector3(1, 0, 0)), this.transform.position, new Vector3(0, 1, 0), GroupMembers.Count));
            break;

        case Formation.Square:
            generatePositions(Formations.GetPolygonFormation(this.transform.position + spread * (new Vector3(1, 0, 0)), this.transform.position, new Vector3(0, 1, 0), 4, GroupMembers.Count));
            break;

        case Formation.Triangle:
            generatePositions(Formations.GetPolygonFormation(this.transform.position + spread * (new Vector3(1, 0, 0)), this.transform.position, new Vector3(0, 1, 0), 3, GroupMembers.Count));
            break;

        case Formation.Polygon:
            if (formationSideCount > 3)
            {
                generatePositions(Formations.GetPolygonFormation(this.transform.position + spread * (new Vector3(1, 0, 0)), this.transform.position, new Vector3(0, 1, 0), formationSideCount, GroupMembers.Count));
            }
            break;
        }
    }
Esempio n. 30
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. 31
0
 /// <summary>
 /// Gets EnemySpawner Formation Script object for positioning each enemy.
 /// </summary>
 /// <param name="form"></param>
 /// <returns></returns>
 public static EnemySpawner GetFormationScript(Formations form)
 {
     EnemySpawner formSpawn = GameObject.FindGameObjectWithTag("phase1").GetComponent<EnemySpawner>();
     switch (form)
     {
         case Formations.Round1Phase1:
             //formSpawn = GameObject.FindGameObjectWithTag("phase1").GetComponent<EnemySpawner>();
             break;
         case Formations.Round1Phase2:
             formSpawn = GameObject.FindGameObjectWithTag("phase2").GetComponent<EnemySpawner>();
             break;
         case Formations.Round1Phase3:
             formSpawn = GameObject.FindGameObjectWithTag("phase31").GetComponent<EnemySpawner>();
             break;
         case Formations.Round1Phase4:
             formSpawn = GameObject.FindGameObjectWithTag("phase41").GetComponent<EnemySpawner>();
             break;
         case Formations.Round1Phase5:
             formSpawn = GameObject.FindGameObjectWithTag("phase51").GetComponent<EnemySpawner>();
             break;
     }
     return formSpawn;
 }
Esempio n. 32
0
    /// <summary>
    /// Creates the paths for waves 2 - 5.
    /// </summary>
    /// <param name="form"></param>
    public static void GetWavePaths(Formations form, int RoundNumber)
    {
        Vector3[] path = null;
        // Get formation script
        Debug.Log("Current Spawn: ".Bold().Colored(Colors.green) + CurrentRoundPhase + " Wave #:".Bold() + form);
        //Debug.Log("GetWavePaths Round#: ".Bold().Colored(Colors.green) + GalagaHelper.RoundNumber);
        EnemySpawner formSpawn = GetFormationScript(form);
        // FourthWavePath=8 is used for waves 4 & 5.
        // SecondWavePath=11 is used for waves 2 & 3.
        // Check to see if paths are clear before putting path in.
        if (FourthWavePath[0].x == 0f)
        {
            // Reset WaveDelay to zero
            Wave1Delay = 0.0f;
            Vector3[] circleNodes = new Vector3[7];
            GameObject middlePt = GameObject.FindGameObjectWithTag("Point2");

            //Even number traits Left Circle, Odd number Right Circle
            if ((int)form % 2 == 0)
            {
                // Get Right circle
                circleNodes = iTweenPath.GetPath("LeftCircle");
                //Debug.Log("<color=red> path nodes:</color> " + iTweenPath.GetPath("LeftCircle").GetUpperBound(0));
            }
            else
            {
                // Get Right circle
                circleNodes = iTweenPath.GetPath("RightCircle");
                //Debug.Log("<color=red> path nodes:</color> " + iTweenPath.GetPath("RightCircle").GetUpperBound(0));
            }

            // Spawning and Positions
            // Wave # > 3 == Respawn && 8 positions, Wave == 3 == spawn_bottomRight, Wave == 2 = spawn_bottomleft
            if ((int)form > 3)
            {
                // Spawn point
                GameObject spawnPoint = new GameObject();
                spawnPoint = GameObject.FindGameObjectWithTag("Respawn");
                if (RoundNumber == 2 && formSpawn.spawnEntranceRight)
                {
                    Vector3 offset = new Vector3(20, 0, 0);
                    // Path Positions
                    path = new Vector3[8];
                    path[0] = spawnPoint.transform.position;
                    path[1] = circleNodes[3] + offset;
                    path[2] = circleNodes[4] + offset;
                    path[3] = circleNodes[5] + offset;
                    path[4] = circleNodes[6] + offset;
                    path[5] = middlePt.transform.position + offset;
                    path[6] = formSpawn.transform.position + offset;
                    path[7] = formSpawn.currentSpawnPos.position;
                }
                else 
                {
                    // Path Positions
                    path = new Vector3[8];
                    path[0] = spawnPoint.transform.position;
                    path[1] = circleNodes[3];
                    path[2] = circleNodes[4];
                    path[3] = circleNodes[5];
                    path[4] = circleNodes[6];
                    path[5] = middlePt.transform.position;
                    path[6] = formSpawn.transform.position;
                    path[7] = formSpawn.currentSpawnPos.position;
                }
            }
            if ((int)form == 3)
            {
                // Spawn point
                GameObject spawnPoint = new GameObject();
                spawnPoint = GameObject.FindGameObjectWithTag("Spawn_BottomRight");
                if (RoundNumber == 2 && formSpawn.spawnEntranceRight)
                {
                    Vector3 offset = new Vector3(20, 0, 0);
                    // Path Positions
                    path = new Vector3[11];
                    path[0] = spawnPoint.transform.position;
                    path[1] = circleNodes[0] + offset;
                    path[2] = circleNodes[1] + offset;
                    path[3] = circleNodes[2] + offset;
                    path[4] = circleNodes[3] + offset;
                    path[5] = circleNodes[4] + offset;
                    path[6] = circleNodes[5] + offset;
                    path[7] = circleNodes[6] + offset;
                    path[8] = middlePt.transform.position + offset;
                    path[9] = formSpawn.transform.position + offset;
                    path[10] = formSpawn.currentSpawnPos.position;
                }
                else
                {
                    // Path Positions
                    path = new Vector3[11];
                    path[0] = spawnPoint.transform.position;
                    path[1] = circleNodes[0];
                    path[2] = circleNodes[1];
                    path[3] = circleNodes[2];
                    path[4] = circleNodes[3];
                    path[5] = circleNodes[4];
                    path[6] = circleNodes[5];
                    path[7] = circleNodes[6];
                    path[8] = middlePt.transform.position;
                    path[9] = formSpawn.transform.position;
                    path[10] = formSpawn.currentSpawnPos.position;
                    //Debug.Log(formSpawn.currentSpawnPos.position.ToString().Bold());
                }
            }
            else if ((int)form == 2)
	        {
                // Spawn Point
                GameObject spawnPoint = new GameObject();
                spawnPoint = GameObject.FindGameObjectWithTag("Spawn_BottomLeft");

                if (RoundNumber == 2 && formSpawn.spawnEntranceRight)
                {
                    // Path positions slight right
                    Vector3 offset = new Vector3(20, 0, 0);
                    path = new Vector3[11];
                    path[0] = spawnPoint.transform.position;
                    path[1] = circleNodes[0] + offset;
                    path[2] = circleNodes[1] + offset;
                    path[3] = circleNodes[2] + offset;
                    path[4] = circleNodes[3] + offset;
                    path[5] = circleNodes[4] + offset;
                    path[6] = circleNodes[5] + offset;
                    path[7] = circleNodes[6] + offset;
                    path[8] = middlePt.transform.position + offset;
                    path[9] = formSpawn.transform.position + offset;
                    path[10] = formSpawn.currentSpawnPos.position;
                }
                else
                {
                    // Path positions
                    path = new Vector3[11];
                    path[0] = spawnPoint.transform.position;
                    path[1] = circleNodes[0];
                    path[2] = circleNodes[1];
                    path[3] = circleNodes[2];
                    path[4] = circleNodes[3];
                    path[5] = circleNodes[4];
                    path[6] = circleNodes[5];
                    path[7] = circleNodes[6];
                    path[8] = middlePt.transform.position;
                    path[9] = formSpawn.transform.position;
                    path[10] = formSpawn.currentSpawnPos.position;
                }
	        }

            // SecondWavePath == 11
            // FourthWavePath == 8
            if (path.Length == 8)
            {
                FourthWavePath = path;
            }
            else
	        {
                SecondWavePath = path;
	        }
        }

        // Change last position to the formation's last position.
        if (path.Length == 8)
        {
            FourthWavePath[7] = formSpawn.currentSpawnPos.position;
            Debug.Log(formSpawn.currentSpawnPos.position.ToString().Bold());
        }
        else
	    {
            SecondWavePath[10] = formSpawn.currentSpawnPos.position;
            Debug.Log(formSpawn.currentSpawnPos.position.ToString().Bold());
	    }
    }
Esempio n. 33
0
 /// <summary>
 /// Clears out both Enemy object list and Enemy Path Params list.
 /// </summary>
 public static void RemovePaths()
 {
     isWaveOneStarted = false;
     enemyObjects.Clear();
     EnemyPathParams.Clear();
     Debug.Log("<color=red>ENEMY OBJECTS CLEARED</color>");
     CurrentRoundPhase += 1;
 }