Beispiel #1
0
 public Bullet(IFF identification, Vector3 position, Vector3 direction, float speed)
 {
     this.Identification = identification;
     this.StartPosition = position;
     this.Direction = direction;
     this.Speed = speed;
 }
Beispiel #2
0
 void Start()
 {
     am  = FindObjectOfType <AllegianceManager>();
     iff = transform.root.GetComponentInChildren <IFF>();
     am.AddFactionLeaderToList(iff.GetIFFAllegiance(), this);
     //Debug.Log(gameObject.name + " attempted to add an FL for allegiance: " + iff.GetIFFAllegiance());
 }
Beispiel #3
0
    public void AddLine()
    {
        int i;

        SelectedLine = Spirographe.GetActiveSpiroFormule();
        SelectedLine.profondeur++;
        i = SelectedLine.profondeur - 1;     //avant dernière ligne avant le crayon
        TextNumeroDisque.GetComponent <Text>().text = (i + 1).ToString();
        int NbLignesCrees = PanelLignes.transform.childCount;

        if (NbLignesCrees < SelectedLine.profondeur)
        {
            IFR.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().index = i;
            IFR.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().RefreshContent();
            IFF.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().index = i;
            IFF.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().RefreshContent();
            IFRO.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().index = i;
            IFRO.GetComponent <InputField>().GetComponent <InputFieldPanelDisques>().RefreshContent();
            ToggleActiveDisque.GetComponent <ToggleRotAxe>().index = i;
            ToggleActiveDisque.GetComponent <ToggleRotAxe>().RefreshContent();
            GameObject NewLine = Instantiate(LigneSpiro);
            NewLine.name = "Ligne" + (i).ToString();
            NewLine.SetActive(true);
            NewLine.transform.SetParent(PanelLignes.transform, false);
        }
        else
        {
            PanelLignes.transform.GetChild(i).gameObject.SetActive(true);
        }
        RefreshPanel();
        //PanelOptionTousDisques.GetComponent<PanelOptionTousDisques>().BuildPanel(); //refresh panel tous disques too
        Spirographe.ValueChange();         //Call ValueChange Event
    }
Beispiel #4
0
 public CombatItem(int time, long src_agent, long dst_agent, int value, int buff_dmg, int overstack_value,
                   int skill_id, int src_instid, int dst_instid, int src_master_instid, IFF iff, int buff, Result result,
                   Activation is_activation, BuffRemove is_buffremove, int is_ninety, int is_fifty, int is_moving,
                   StateChange is_statechange, int is_flanking, int is_shields)
 {
     this.time              = time;
     this.src_agent         = src_agent;
     this.dst_agent         = dst_agent;
     this.value             = value;
     this.buff_dmg          = buff_dmg;
     this.overstack_value   = overstack_value;
     this.skill_id          = skill_id;
     this.src_instid        = src_instid;
     this.dst_instid        = dst_instid;
     this.src_master_instid = src_master_instid;
     this.iff            = iff;
     this.is_buff        = buff;
     this.result         = result;
     this.is_activation  = is_activation;
     this.is_buffremove  = is_buffremove;
     this.is_ninety      = is_ninety;
     this.is_fifty       = is_fifty;
     this.is_moving      = is_moving;
     this.is_statechange = is_statechange;
     this.is_flanking    = is_flanking;
     this.is_shields     = is_shields;
 }
Beispiel #5
0
 // Start is called before the first frame update
 void Start()
 {
     ut                  = FindObjectOfType <UnitTracker>();
     ownIFF              = GetComponentInChildren <IFF>();
     attackRange         = weaponLifetime * weaponSpeed;
     selectedFiringSound = SelectSoundFromArray(firingSounds);
     sh                  = GetComponentInChildren <StealthHider>();
 }
        //: base(graphicsDevice, content, texture, billboardSize, position, position + direction)
        //: base(graphicsDevice, content, texture, billboardSize, position, position + Vector3.Normalize(direction) * billboardSize.X)
        //:base(id, position, direction, speed)
        public LaserBillboardBullet(IFF id, GraphicsDevice graphicsDevice,
			ContentManager content, Vector3 position, Vector3 direction, float speed, Texture2D texture, Vector2 billboardSize, int mode)
            : this(id, graphicsDevice, content, position, position+Vector3.Normalize(direction), direction, speed, texture, Color.White, BlendState.AlphaBlend, billboardSize, 0)
        {
            /*IsActive = true;
            Direction.Normalize();
            this.Mode = mode;

            laserRenderer = new LaserBillboard(graphicsDevice, content, texture, billboardSize, position, position + Vector3.Normalize(direction) * billboardSize.X);*/
        }
        //: base(graphicsDevice, content, texture, billboardSize, startPosition, endPosition, laserColor, laserBlendState)
        public LaserBillboardBullet(IFF id, GraphicsDevice graphicsDevice,
			ContentManager content, Vector3 startPosition, Vector3 endPosition, Vector3 direction, float speed, Texture2D texture, Color laserColor, BlendState laserBlendState, Vector2 billboardSize, int mode)
            : base(id, startPosition, direction, speed)
        {
            MAX_DISTANCE = 2000;
            IsActive = true;
            Direction.Normalize();
            this.Mode = mode;

            laserRenderer = new LaserBillboard(graphicsDevice, content, texture, billboardSize, startPosition, endPosition);
        }
Beispiel #8
0
    // Start is called before the first frame update
    void Start()
    {
        srs = transform.root.GetComponentsInChildren <SpriteRenderer>();

        rb               = transform.root.GetComponentInChildren <Rigidbody2D>();
        hiderColl        = GetComponent <CircleCollider2D>();
        hiderColl.radius = hiderRadius_Base;
        cs               = transform.root.GetComponentInChildren <ControlSource>();
        iff              = transform.root.GetComponentInChildren <IFF>();
        am               = FindObjectOfType <AllegianceManager>();
        FadeOrTurnInvisible();
    }
Beispiel #9
0
 // Start is called before the first frame update
 public override void OnStartServer()
 {
     base.OnStartServer();
     ut                      = FindObjectOfType <UnitTracker>();
     ownIFF                  = GetComponent <IFF>();
     attackRange             = weaponLifetime * weaponSpeed;
     sh                      = GetComponentInChildren <StealthHider>();
     ss                      = GetComponentInChildren <StealthSeeker>();
     ss.OnSeekerDetection   += EvaluateDetectedObject;
     ss.OnSeekerLostContact += HandleLostContact;
     ut.AddUnitToTargetableList(gameObject);
     ownIFF.OnChangeIFF += CheckForAlliesAsTargetsAfterIFFChange;
 }
        //: base(graphicsDevice, content, texture, billboardSize, startPosition, endPosition, laserColor, laserBlendState)
        public LaserBillboardBullet(IFF id, GraphicsDevice graphicsDevice,
			ContentManager content, Drawable user, Drawable target, Vector3 direction, float speed, Texture2D texture, Color laserColor, BlendState laserBlendState, Vector2 billboardSize, int mode)
            : base(id, user.Position, direction, speed)
        {
            MAX_DISTANCE = 2000;
            IsActive = true;
            Direction.Normalize();
            this.Mode = mode;
            this.User = user;
            this.Target = target;

            //laserRenderer = new LaserBillboard(graphicsDevice, content, texture, billboardSize, startPosition, endPosition);
            laserRenderer = new LaserBillboard(graphicsDevice, content, texture, billboardSize, user.Position, target.Position, Color.White, BlendState.Additive, 1);
        }
Beispiel #11
0
    public override void OnStartServer()
    {
        base.OnStartServer();
        iff = GetComponent <IFF>();
        am  = FindObjectOfType <AllegianceManager>();
        sr  = GetComponent <SpriteRenderer>();
        SelectCityName();
        iff.SetIFFAllegiance(IFF.feralIFF);
        SpawnHousesWithinCity(numberOfHousesToSpawn);
        SpawnTurretsWithinCity(numberOfTurretsToSpawn);
        timeSinceLastHouseCreation = UnityEngine.Random.Range(0, randomTimeBetweenHouseSpawn);
        //ConvertHousesToTurrets();

        //SetAllegianceForBuildingsInCity(IFF.feralIFF);
    }
Beispiel #12
0
 protected virtual void Start()
 {
     ut = FindObjectOfType <UnitTracker>();
     ut.AddUnitToTargetableList(gameObject);
     move     = GetComponentInChildren <Movement>();
     attack   = GetComponentInChildren <Attack>();
     targetGO = GameObject.FindGameObjectWithTag("Player");
     iff      = GetComponent <IFF>();
     cm       = FindObjectOfType <CityManager>();
     health   = GetComponentInChildren <Health>();
     am       = FindObjectOfType <AllegianceManager>();
     if (TryGetComponent <NavMeshAgent>(out nma))
     {
         nma.updateRotation = false;
     }
 }
Beispiel #13
0
 private void HookIntoLocalUISystems()
 {
     if (hasAuthority)
     {
         playerAtThisComputer = ClientInstance.ReturnClientInstance();
         uim       = FindObjectOfType <UIManager>();
         shiftKnob = uim.GetShiftKnob(playerAtThisComputer);
         uim.GetShiftPositions(playerAtThisComputer, out gearShiftPositions[0], out gearShiftPositions[1], out gearShiftPositions[2]);
         tpd = uim.GetTPD(playerAtThisComputer);
         iff = GetComponent <IFF>();
         int myIFF = playerAtThisComputer.GetComponent <FactionLeader>().GetMasterIFFAllegiance();
         iff.SetIFFAllegiance(myIFF);
         flagImage        = uim.GetFlagUIElement(playerAtThisComputer);
         flagImage.sprite = am.GetFlagOfAllegiance(myIFF);
         tm = playerAtThisComputer.GetComponent <TurretMaker>();
         ct = GetComponentInChildren <CaptureTool>();
     }
 }
Beispiel #14
0
        protected void DrawWireFrames(CanvasDrawingSession ds)
        {
#if DEBUG
            lock ( PFSim )
            {
                if (ShowWireFrame)
                {
                    foreach (IForceField IFF in PFSim.Fields)
                    {
                        IFF.WireFrame(ds);
                        IFF.FreeWireFrame();
                    }
                }
                else
                {
                    foreach (IForceField IFF in PFSim.Fields)
                    {
                        IFF.FreeWireFrame();
                    }
                }
            }
#endif
        }
Beispiel #15
0
        public Missile(IFF identification, Object user, Object target, float speed, Vector3 direction, Vector3 position, float scale, string filePath)
            : base(identification, position, direction, speed)
        {
            /*this.Position = position;
            startPosition = position;
            this.Speed = speed;
            this.Direction = direction;
            Direction.Normalize();
            this.Right = user.Right;
            this.Up = user.Up;
            this.Velocity = Direction * speed;
            Load(filePath);*/

            MAX_DISTANCE = 2000;
            this.Target = target;
            Position = position;
            upPosition = position + Vector3.Up;

            positions = new List<Vector3>();
            Renderer = new Object(position, scale, filePath);
            billboardStrip = new BillboardStrip(Level.graphicsDevice, content,
                content.Load<Texture2D>("Textures\\Lines\\smoke"), new Vector2(10, 30), positions, true);
        }
        //:base(graphicsDevice, content, texture, billboardSize, position, position + direction)
        public LaserBillboardBullet(IFF id, GraphicsDevice graphicsDevice,
			ContentManager content, Vector3 position, Vector3 direction, float speed, Texture2D texture, Vector2 billboardSize)
            : this(id, graphicsDevice, content, position, direction, speed, texture, billboardSize, 0)
        {
        }
Beispiel #17
0
 public Ev(
     ulong time, ulong srcAgent, ulong dstAgent, int value, int buffDmg, uint overStackValue, uint skillId,
     ushort srcInstId, ushort dstInstId, ushort srcMasterInstId, ushort dstMasterInstId, IFF iff, bool buff,
     byte result, Activation isActivation, BuffRemove isBuffRemove, bool isNinety, bool isFifty, bool isMoving,
     StateChange isStateChange, bool isFlanking, bool isShields, bool isOffCycle, byte pad61, byte pad62, byte pad63,
     byte pad64
     )
 {
     this.Time            = time;
     this.SrcAgent        = srcAgent;
     this.DstAgent        = dstAgent;
     this.Value           = value;
     this.BuffDmg         = buffDmg;
     this.OverStackValue  = overStackValue;
     this.SkillId         = skillId;
     this.SrcInstId       = srcInstId;
     this.DstInstId       = dstInstId;
     this.SrcMasterInstId = srcMasterInstId;
     this.DstMasterInstId = dstMasterInstId;
     this.Iff             = iff;
     this.Buff            = buff;
     this.Result          = result;
     this.IsActivation    = isActivation;
     this.IsBuffRemove    = isBuffRemove;
     this.IsNinety        = isNinety;
     this.IsFifty         = isFifty;
     this.IsMoving        = isMoving;
     this.IsStateChange   = isStateChange;
     this.IsFlanking      = isFlanking;
     this.IsShields       = isShields;
     this.IsOffCycle      = isOffCycle;
     this.Pad61           = pad61;
     this.Pad62           = pad62;
     this.Pad63           = pad63;
     this.Pad64           = pad64;
 }
Beispiel #18
0
    public void BuildPanel()
    {
        int        profondeur;
        GameObject LineCurr;         //

        //SpiroParametrableActive=Spirographe.GetActiveObject();
        SelectedLine = Spirographe.GetActiveSpiroFormule();
        if (SelectedLine == null)
        {
            profondeur = 0;
        }
        else
        {
            profondeur = SelectedLine.profondeur;
        }
        int NbLignesCrees = PanelLignes.transform.childCount;

        for (int i = 0; i < profondeur; i++)
        {
            if (i < NbLignesCrees)
            {
                LineCurr = PanelLignes.transform.GetChild(i).gameObject;
                LineCurr.SetActive(true);
            }
            else
            {
                TextNumeroDisque.GetComponent <Text>().text       = (i + 1).ToString();
                IFR.GetComponent <InputFieldPanelDisques>().index = i;
                IFR.GetComponent <InputFieldPanelDisques>().RefreshContent();
                IFR.GetComponent <InputFieldPanelDisques>().Start();
                IFF.GetComponent <InputFieldPanelDisques>().index = i;
                IFF.GetComponent <InputFieldPanelDisques>().RefreshContent();
                IFF.GetComponent <InputFieldPanelDisques>().Start();
                IFRO.GetComponent <InputFieldPanelDisques>().index = i;
                IFRO.GetComponent <InputFieldPanelDisques>().RefreshContent();
                IFRO.GetComponent <InputFieldPanelDisques>().Start();
                ToggleActiveDisque.GetComponent <ToggleRotAxe>().index = i;
                ToggleActiveDisque.GetComponent <ToggleRotAxe>().RefreshContent();
                GameObject NewLine = Instantiate(LigneSpiro);
                NewLine.name = "Ligne" + (i).ToString();
                NewLine.SetActive(true);
                NewLine.transform.SetParent(PanelLignes.transform, false);
            }
        }
        GetComponent <RectTransform>().ForceUpdateRectTransforms();
        //Debug.Log("Building Panel big");
        //Reste à cacher les lignes restantes éventuelles :
        if (profondeur <= NbLignesCrees)
        {
            for (int i = profondeur; i < NbLignesCrees; i++)
            {
                PanelLignes.transform.GetChild(i).gameObject.SetActive(false);
            }
        }

        //Gestion affichage des coches RotAxe

        /*if (profondeur>0)
         * {
         *      RefreshCochesActivation();
         *      RefreshFacteurTransmission();
         * }*/
        RefreshPanel();
    }
Beispiel #19
0
        private void Power_Click(object sender, EventArgs e)
        {
            int sum = 0;


            //converts the rows to integers for the cells
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                sum += Convert.ToInt32(dataGridView1.Rows[i].Cells["heartrate"].Value);
            }



            int count_row = dataGridView1.Rows.Count;

            GetCalculations calc = new GetCalculations(); //use Get Calculations to determine average

            double avg = calc.CalculateAverage(sum, count_row);


            PowerTextBox.AppendText(Environment.NewLine);
            PowerTextBox.AppendText(Environment.NewLine + "Average heart rate: " + avg.ToString("N0"));



            var lines = File.ReadAllLines(openFileDialog1.FileName);

            foreach (var line in lines)
            {
                if (line.StartsWith("Lower3="))
                {
                    Lower3 = double.Parse(line.Replace("Lower3=", ""));
                    PowerTextBox.AppendText(Environment.NewLine);
                    PowerTextBox.AppendText(Environment.NewLine + "Threshhold Heartrate: " + Lower3);
                }

                if (line.StartsWith("Length="))
                {
                    Length = TimeSpan.Parse(line.Replace("Length=", ""));

                    var    time          = Length.ToString();    //initiate variable for length of session
                    double seconds       = TimeSpan.Parse(time).TotalSeconds;
                    double secondslength = seconds;              //convert the time of session to seconds
                    double dec_length    = secondslength / 3600; // time of session as a decimal



                    PowerTextBox.AppendText(Environment.NewLine);
                    PowerTextBox.AppendText(Environment.NewLine + "Length of Workout: " + dec_length.ToString("N2"));
                }

                if (line.StartsWith("RestHR="))
                {
                    RestHR = double.Parse(line.Replace("RestHR=", ""));
                    PowerTextBox.AppendText(Environment.NewLine);
                    PowerTextBox.AppendText(Environment.NewLine + "Resting heart rate: " + RestHR);

                    var    time          = Length.ToString();    //initiate variable for length of session
                    double seconds       = TimeSpan.Parse(time).TotalSeconds;
                    double secondslength = seconds;              //convert the time of session to seconds
                    double dec_length    = secondslength / 3600; // time of session as a decimal

                    double           TSS;
                    PowerCalculation powercalc = new PowerCalculation();
                    TSS = powercalc.CalculateTSS(avg, RestHR, Lower3, dec_length);
                    //TTS = powercalc.CalculateTSS(144, 46, 170, 1.1); these are actual figures from the file
                    PowerTextBox.AppendText(Environment.NewLine);
                    PowerTextBox.AppendText(Environment.NewLine + "Training Stress Score (TSS):" + "" + TSS.ToString("N2"));
                }
            }


            double           NP;                //normalised power
            double           nnp        = 168;; //in our case I used the average heart rate and not the rolling average heart rate
            PowerCalculation powercalc1 = new PowerCalculation();

            NP = powercalc1.CalculateNP(nnp);

            double IFF;         //Intensity Function
            double func = 320;; //function threshold as supplied by the client
            int    sum4 = 0;

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                sum4 += Convert.ToInt32(dataGridView1.Rows[i].Cells["power"].Value);
            }



            GetCalculations calc1 = new GetCalculations(); //use Get Calculations to determine average


            double avg4 = calc1.CalculateAverage(sum4, count_row);


            PowerCalculation powercalc2 = new PowerCalculation();

            IFF = powercalc2.CalculateIF(avg4, func);



            PowerTextBox.AppendText(Environment.NewLine);
            PowerTextBox.AppendText(Environment.NewLine + "Normalised Power (NP):" + NP);

            PowerTextBox.AppendText(Environment.NewLine);
            PowerTextBox.AppendText(Environment.NewLine + "Intensity Factor (IF):" + IFF.ToString("N2"));


            MovingAverageCalculator calculator = new MovingAverageCalculator(30);



            // loop through the values 1 to 10
            //for (int i = 1; i <= 10; i++)
            //{
            //    // write out the average
            //    Console.WriteLine(calculator.NextValue(i));
            //}



            //for (int i = 0; i < dataGridView1.Rows.Count; i++)
            //{

            //    float[] sumpower = new float[Convert.ToInt32(dataGridView1.Rows[i].Cells["power"].Value)];
            //    //PowerTextBox.AppendText(Environment.NewLine + calculator.NextValue(i));
            //    PowerTextBox.AppendText(Environment.NewLine + sumpower);
            //}
        }