Beispiel #1
0
    //This function will detect object collision
    //projectile will stop no matter what
    public void impact_object(GameObject obj, Vector2 hit_point)
    {
        float heat = Damage();

        if (obj.tag == "structure")//Structure
        {
            if (local && heat > 0)
            {
                Body_generic activator_body = activator.GetComponent <Body_generic>();
                if (activator_body.dmg_tags.Contains(obj.tag) && activator.layer != obj.layer)
                {
                    float angle = Mathf.Atan2(aimdir.y, aimdir.x) * 180 / Mathf.PI;
                    //If Client authoritates laser
                    if (activator_body.isPlayer && !activator_body.isServer)
                    {
                        activator_body.player_controller.add_to_shot_list(obj, heat, hit_point, 0, CONSTANTS.seed_float_to_short(angle, 360), false, 1);
                    }
                    else//Server client || npc authoritates laser
                    {
                        obj.GetComponent <Structure_generic>().health -= CONSTANTS.heat_to_physics(heat);
                    }
                    if (activator_body.isLocalPlayer)
                    {
                        activator_body.player_controller.hit_mark();
                    }
                }
            }
        }
        if (obj.GetComponent <Rigidbody2D>() != null)
        {
            Vector2 force = CONSTANTS.DAMAGE_FORCE_MULTIPLIER * (end - start).normalized * heat / 20;
            obj.GetComponent <Rigidbody2D>().AddForceAtPosition(force, hit_point);
        }
    }
Beispiel #2
0
    void lobby_generate_cvar_file()
    {
        StreamWriter cvar_writer = new StreamWriter(lobbyManager.cvar_path);

        if (cvar_writer == null)
        {
            return;
        }

        cvar_writer.WriteLine("tk_human " + tickets_human);
        cvar_writer.WriteLine("tk_robot " + tickets_robot);
        cvar_writer.WriteLine("tk_zombie " + tickets_zombie);
        cvar_writer.WriteLine("num_human " + team_num_human);
        cvar_writer.WriteLine("num_robot " + team_num_robot);
        cvar_writer.WriteLine("num_zombie " + team_num_zombie);
        cvar_writer.WriteLine("passThru " + CONSTANTS.bool_to_int(allyBulletPassThru));
        cvar_writer.WriteLine("losVision " + CONSTANTS.bool_to_int(losVision));
        cvar_writer.WriteLine("maxSkills " + maxSkillSpentPerDeath);
        cvar_writer.WriteLine("teamTransparent " + CONSTANTS.bool_to_int(team_transparent));
        cvar_writer.WriteLine("rspwnTime " + respawn_time);
        cvar_writer.WriteLine("startMoney " + insurance_money);
        cvar_writer.WriteLine("map " + map);

        cvar_writer.Close();
    }
Beispiel #3
0
    private void populateDropdown()
    {
        var planetTypeDataAccess = new PlanetTypesDataAccess(CONSTANTS.GetConnection());
        var planetTypes          = planetTypeDataAccess.GetPlanetTypeNames();

        planetDropDown.AddOptions(planetTypes);
    }
        public ActionResult Index()
        {
            string             userId      = User.Identity.GetUserId();
            ApplicationUser    currentUser = UserRepository.GetUserById(userId);
            HomeIndexViewModel model       = HomeIndexViewModel.CreateNewViewModel(currentUser, DbContext, 5, 5, 5);

            // Display benchmark data
            if (User.IsInRole(UserRolesEnum.Admin.ToString()))
            {
                FileSystemRepository fileSystemRepository = new FileSystemRepository(Server, FileSystemRepository.BenchmarkFolder);

                //string fileName = $"{Server.MachineName}_Benchmark.json";
                string fileName = CONSTANTS.GetDefaultFileNameForBenchmark(Server);

                (List <ActionResultBenchmark> result, bool hasLoaded, string message) = fileSystemRepository
                                                                                        .LoadJsonFile <List <ActionResultBenchmark> >(fileName);

                if (hasLoaded)
                {
                    ViewBag.BenchmarkResults = result.OrderByDescending(p => p.Created).ToList();
                }

                ViewBag.BenchmarkMessage  = message;
                ViewBag.BenchmarkFileName = fileName;
            }

            return(View(model));
        }
Beispiel #5
0
 //Outputs
 void OnTriggerEnter2D(Collider2D collider2D)
 {
     if (collider2D.tag != "" && collider2D.tag != triggerTag)
     {
         return;
     }
     volumeCounter++;
     if (allIn)
     {
         Collider2D[] colliders = Physics2D.OverlapAreaAll(CONSTANTS.VEC_NULL, -CONSTANTS.VEC_NULL, gameObject.layer);
         int          count     = 0;
         if (triggerTag != "")
         {
             for (int i = 0; i < colliders.Length; i++)
             {
                 if (colliders[i].tag == triggerTag)
                 {
                     count++;
                 }
             }
         }
         else
         {
             count = colliders.Length;
         }
         if (volumeCounter < count)//If not all entities inside volume, dont trigger
         {
             return;
         }
     }
     //Action
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnStartTouch, I_O);
 }
Beispiel #6
0
 void Start()
 {
     selfTransform = gameObject.GetComponent <Transform>();
     renderer      = GetComponentInChildren <Renderer>();
     CST           = GameObject.Find("Constants").GetComponent <CONSTANTS>();
     changeColor(CST.safeColor);
     agent.stoppingDistance = CST.stoppingDistance;
 }
Beispiel #7
0
 void sync_server()
 {
     syncx_compressed     = CONSTANTS.comp_pos(propRB.position.x);
     syncy_compressed     = CONSTANTS.comp_pos(propRB.position.y);
     syncspeed_compressed = CONSTANTS.comp_pos(propRB.velocity.magnitude);
     syncrot    = propRB.rotation;
     syncrotvel = propRB.angularVelocity;
 }
Beispiel #8
0
 //Computed in local machine, server/local client;
 public sbyte[] get_bullet_seed(float firecone, int frame_stack = 1)
 {
     sbyte[] blt_dir = new sbyte[burst_shots * frame_stack];
     for (int i = 0; i < burst_shots * frame_stack; i++)
     {
         blt_dir[i] = CONSTANTS.seed_float_to_sbyte(Random.Range(-precise - firecone, precise + firecone), precise + accuracy); //CONSTANTS.MAX_GUN_BIAS);// precise + firecone_angle);
     }
     return(blt_dir);
 }
Beispiel #9
0
    public void PlayFx(string name)
    {
        AudioClip audio = Resources.Load(CONSTANTS.get("SFX") + name) as AudioClip;

        if (audio != null)
        {
            this.GetComponent <AudioSource>().PlayOneShot(audio);
        }
    }
Beispiel #10
0
    //This function will detect character collision and calculate damage
    //Return 1: keep the projectile going
    //Return 0: this object shouldn't be impacted
    //Return -1: this projectile is stopped by character
    public int impact_character(Body_hitbox_generic hit_box, Vector2 hit_point)
    {
        Body_generic body = hit_box.body;

        if (body.gameObject == activator)
        {
            return(-1);
        }
        if (local)
        {
            float heat_dmg = 0;
            float angle    = Mathf.Atan2(aimdir.y, aimdir.x) * 180 / Mathf.PI;
            if (activator.GetComponent <Body_generic>().dmg_tags.Contains(body.tag))
            {
                heat_dmg = Damage();
            }
            Vector2 force = CONSTANTS.DAMAGE_FORCE_MULTIPLIER * aimdir.normalized * heat_dmg / 20;

            //If Client authoritates laser
            if (activator.GetComponent <Body_generic>().isPlayer&& !activator.GetComponent <Body_generic>().isServer)
            {
                activator.GetComponent <Player_controller>().add_to_shot_list(body.gameObject, heat_dmg, hit_point, force.magnitude, CONSTANTS.seed_float_to_short(angle, 360), false, 1);
                body.GetComponent <Rigidbody2D>().AddForceAtPosition(force, hit_point);
            }
            else//Server client || npc authoritates laser
            {
                if (heat_dmg > 0)
                {
                    body.damage(activator, force, dmg_physics: CONSTANTS.heat_to_physics(heat_dmg), dmg_thermal: heat_dmg, headshot: false);
                    if (body.isPlayer && !body.hasAuthority)//Non-server client
                    {
                        body.request_bleed(hit_point, angle, false);
                        body.Rpc_add_force(force);
                    }
                    else//Host or npc
                    {
                        body.request_bleed(hit_point, angle, false);
                        body.GetComponent <Rigidbody2D>().AddForceAtPosition(force, hit_point);
                    }
                }
                //Friendly fire, just force
                else
                {
                    if (body.isPlayer && !body.hasAuthority)//Non-server client
                    {
                        body.Rpc_add_force(force);
                    }
                    else//Host or npc
                    {
                        body.GetComponent <Rigidbody2D>().AddForceAtPosition(force, hit_point);
                    }
                }
            }
        }
        return(-1);
    }
Beispiel #11
0
 private void OnTriggerExit2D(Collider2D collider2D)
 {
     if ((collider2D.tag != "" && collider2D.tag != triggerTag))
     {
         return;
     }
     volumeCounter--;
     //Action
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnEndTouch, I_O);
 }
Beispiel #12
0
 public IEnumerable <Polymorphism> FilterPolys(IEnumerable <Polymorphism> polys)
 {
     if (additionalFilter == null)
     {
         return(CONSTANTS.CommonPolymorphismFilter(polys));
     }
     else
     {
         return(CONSTANTS.CommonPolymorphismFilter(polys.Where(z => additionalFilter(z))));
     }
 }
Beispiel #13
0
    //Fps stack purpose
    public sbyte[] get_bullet_seed_single_incremental(float firecone, float aim_suppress, int frame_stack)
    {
        sbyte[] blt_dir = new sbyte[frame_stack];
        float   bias    = aim_suppress * accuracy / bias_factor;

        for (int i = 0; i < frame_stack; i++)
        {
            blt_dir[i] = CONSTANTS.seed_float_to_sbyte(Random.Range(-precise - firecone, precise + firecone), precise + accuracy); //CONSTANTS.MAX_GUN_BIAS);// precise + (firecone + bias * i));
            firecone   = Mathf.Clamp(firecone + bias, 0, accuracy - accuracy / bias_factor);
        }
        return(blt_dir);
    }
Beispiel #14
0
 public static string get(string key)
 {
     if (strings.Count == 0)
     {
         CONSTANTS.init();
     }
     if (strings.ContainsKey(key))
     {
         return(strings[key]);
     }
     return(string.Empty);
 }
Beispiel #15
0
    void Start()
    {
        GlobalFunctions.isLoading = false;
        if (canvas != null)
        {
            if (canvas.activeInHierarchy)
            {
                canvas.SetActive(false);
            }
        }
        if (GameOverCanvas != null)
        {
            if (GameOverCanvas.activeInHierarchy)
            {
                GameOverCanvas.SetActive(false);
            }
        }
        customStyle = GlobalFunctions.getMenuButtonStyle();
        rules       = EasyLevelRules.LoadLevels(level);
        cardList.Clear();
        canSelect = true;
        clicks    = 0;
        for (int x = rules.maxCards; x > 0; x--)
        {
            string cardToUse = "card" + RNG.Next(1, CONSTANTS.TOTAL_CARD_NUMBERS).ToString();
            //To Avoid Repeated Images
            while (cardList.FindAll(find => find.name == cardToUse).Count != 0)
            {
                cardToUse = "card" + RNG.Next(1, CONSTANTS.TOTAL_CARD_NUMBERS).ToString();
            }

            EasyCard firstCard = new EasyCard();
            firstCard.id       = x.ToString();
            firstCard.name     = cardToUse;
            firstCard.backface = Resources.Load(CONSTANTS.get("CARD_IMG") + "cardback") as Texture2D;
            firstCard.image    = Resources.Load(CONSTANTS.get("CARD_IMG") + cardToUse) as Texture2D;
            firstCard.moveBackContent();
            firstCard.moveContent();
            firstCard.setTexture();
            addCardRandomly(firstCard);

            EasyCard secondCard = new EasyCard();
            secondCard.id       = x.ToString();
            secondCard.name     = cardToUse;
            secondCard.backface = Resources.Load(CONSTANTS.get("CARD_IMG") + "cardback") as Texture2D;
            secondCard.image    = Resources.Load(CONSTANTS.get("CARD_IMG") + cardToUse) as Texture2D;
            secondCard.moveBackContent();
            secondCard.moveContent();
            addCardRandomly(secondCard);
        }
    }
Beispiel #16
0
    public static GUIStyle getLabelStyle()
    {
        GUIStyle customStyle = new GUIStyle();

        customStyle.normal.background = Resources.Load(CONSTANTS.get("LBL") + "Label") as Texture2D;
        customStyle.hover.background  = Resources.Load(CONSTANTS.get("LBL") + "Label") as Texture2D;;
        customStyle.active.background = Resources.Load(CONSTANTS.get("LBL") + "Label") as Texture2D;;
        customStyle.font             = Resources.Load("UI/Font/SAOUITT-Bold") as Font;
        customStyle.fontSize         = 30;
        customStyle.normal.textColor = Color.white;
        customStyle.hover.textColor  = Color.yellow;
        customStyle.active.textColor = Color.red;
        customStyle.alignment        = TextAnchor.MiddleCenter;
        return(customStyle);
    }
Beispiel #17
0
    void Update()
    {
        if (!isServer)
        {
            temp         = server_pos;
            server_pos.x = CONSTANTS.decomp_pos(syncx_compressed);
            server_pos.y = CONSTANTS.decomp_pos(syncy_compressed);


            propRB.velocity = (server_pos - temp).normalized * CONSTANTS.decomp_pos(syncspeed_compressed);
            interpolator.interpolate(server_pos);

            //propRB.angularVelocity = syncrotvel;
            interpolator.interpolate_rot(syncrot);
        }
        else
        {
            sync_server();

            /*
             * if(CONSTANTS.comp_pos(propRB.position.x) != syncx_compressed)
             * {
             *  syncx_compressed = CONSTANTS.comp_pos(propRB.position.x);
             * }
             * if (CONSTANTS.comp_pos(propRB.position.y) != syncy_compressed)
             * {
             *  syncy_compressed = CONSTANTS.comp_pos(propRB.position.y);
             * }
             * if (CONSTANTS.comp_pos(propRB.velocity.x) != syncvelx_compressed)
             * {
             *  syncvelx_compressed = CONSTANTS.comp_pos(propRB.velocity.x);
             * }
             * if (CONSTANTS.comp_pos(propRB.velocity.y) != syncvely_compressed)
             * {
             *  syncvely_compressed = CONSTANTS.comp_pos(propRB.velocity.y);
             * }
             * if(propRB.rotation != syncrot)
             * {
             *  syncrot = transform.rotation.eulerAngles.z;
             * }
             * if(propRB.angularVelocity != syncrotvel)
             * {
             *  syncrotvel = propRB.angularVelocity;
             * }
             */
        }
    }
Beispiel #18
0
    public void Rpc_spawn_blood(GameObject[] victim, short[] pox, short[] angle, bool[] isheadshot)
    {
        for (int i = 0; i < victim.Length && victim[i] != null; i++)
        {
            //Decompress coordinates
            float x = pox[i];
            x /= CONSTANTS.SYNC_POS_MUTIPLIER;
            float y = pox[pox.Length / 2 + i];
            y /= CONSTANTS.SYNC_POS_MUTIPLIER;
            Vector2 bleed_pos = new Vector2(x, y);

            //Decompress angle
            float angle_decompressed = CONSTANTS.seed_short_to_float(angle[i], 360);

            victim[i].GetComponent <Body_generic>().bleed(bleed_pos, angle_decompressed, isheadshot[i]);
        }
    }
Beispiel #19
0
 public void OnExtinguished()
 {
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnExtinguished, I_O);
 }
Beispiel #20
0
 public void OnTrigger()
 {
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnTrigger, I_O);
 }
Beispiel #21
0
 //Outputs
 public void OnSpawn()
 {
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnSpawn, I_O);
 }
Beispiel #22
0
    public short get_aim_dir_short()
    {
        Vector2 aimdir = get_aim_vec();

        return(CONSTANTS.seed_float_to_short((Mathf.Atan2(aimdir.y, aimdir.x) * 180 / Mathf.PI), 360));
    }
Beispiel #23
0
 public short get_bullet_seed_single(float aim_dir, float firecone)
 {
     return(CONSTANTS.seed_float_to_short(aim_dir + Random.Range(-precise - firecone, precise + firecone), 360));
 }
Beispiel #24
0
    //This function simulate bullets locally
    public void shoot(GameObject gun_user, short fire_point_x, short fire_point_y, short aim_dir, sbyte[] aim_dir_offset, float lag_prediction = 0)
    {
        Vector2 fire_point = new Vector2(fire_point_x / CONSTANTS.SYNC_POS_MUTIPLIER, fire_point_y / CONSTANTS.SYNC_POS_MUTIPLIER);

        Body_generic user_body = gun_user.GetComponent <Body_generic>();

        if (equip == null)
        {
            equip = GetComponent <Equipable_generic>();
        }
        bool hasAuthority = equip.isServer;

        if (!cvar_watcher.isDedicated() && !Local_precomputation)
        {
            spawn_muzzle();
        }                                                                            //Only spawn muzzle on clients

        float aim_dir_float = CONSTANTS.seed_short_to_float(aim_dir, 360);

        float firecone_maxrange = accuracy + precise;

        if (bullet.tag == "bullet")//Shooting bullet is local authoritative, meaning shooter decides if he hits
        {
            if (aim_dir_offset == null)
            {
                fire_bullet(gun_user, fire_point, aim_dir_float, local_player_protocol(user_body), lag_prediction);
            }
            else
            {
                for (int i = 0; i < aim_dir_offset.Length; i++)
                {
                    float blt_dir = aim_dir_float + CONSTANTS.seed_sbyte_to_float(aim_dir_offset[i], firecone_maxrange);
                    fire_bullet(gun_user, fire_point, blt_dir, local_player_protocol(user_body), lag_prediction);
                }
            }
        }
        else if (bullet.tag == "bullet_laser")//Shooting laser is local authoritative, meaning shooter decides if he hits
        {
            if (aim_dir_offset == null)
            {
                fire_laser(gun_user, fire_point, aim_dir_float, local_player_protocol(user_body));
            }
            else
            {
                for (int i = 0; i < aim_dir_offset.Length; i++)
                {
                    float blt_dir = aim_dir_float + CONSTANTS.seed_sbyte_to_float(aim_dir_offset[i], firecone_maxrange);
                    fire_laser(gun_user, fire_point, blt_dir, local_player_protocol(user_body));
                }
            }
        }
        else if (bullet.tag == "bullet_rocket")//Shooting rocket is server authoritative, meaning server decides if he hits
        {
            if (hasAuthority)
            {
                if (aim_dir_offset == null)
                {
                    fire_rocket(gun_user, fire_point, aim_dir_float, hasAuthority);
                }
                else
                {
                    for (int i = 0; i < aim_dir_offset.Length; i++)
                    {
                        float blt_dir = aim_dir_float + CONSTANTS.seed_sbyte_to_float(aim_dir_offset[i], firecone_maxrange);
                        fire_rocket(gun_user, fire_point, blt_dir, hasAuthority);
                    }
                }
            }
        }
        if (bullet.tag == "bullet_tesla")//This function only runs on local. local simulate path, broadcast path and damage to network
        {
            fire_tesla(gun_user, fire_point, aim_dir_float, local_player_protocol(user_body), null, lag_prediction);
        }
        else if (bullet.tag == "bullet_flame")//Shooting bullet is server authoritative, meaning server decides if he hits
        {
            float blt_dir = aim_dir_float + CONSTANTS.seed_sbyte_to_float(aim_dir_offset[0], firecone_maxrange);
            bullet.transform.rotation = Quaternion.Euler(0, 0, blt_dir - bullet.GetComponent <ParticleSystem>().shape.arc / 2);
            bullet.GetComponent <ParticleSystem>().Emit(burst_shots);
        }
    }
Beispiel #25
0
 //Outputs
 public void OnEntitySpawned()
 {
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnEntitySpawned, I_O);
 }
        public static void RunTests()
        {
            Dictionary <string, Sequence> loadedGenomes = new Dictionary <string, Sequence>();

            System.IO.StreamWriter sw = new System.IO.StreamWriter("FailedTests.txt");
            sw.WriteLine("Haplogroup\tAccession\tReasonFailed\tInGenbankNotHaplogrep\tInHaplogrepNotGenbank");
            //First to load up the accession numbers
            string            fileName = "PhyloTreeSequences.fasta.gz";
            FastAZippedParser fap      = new FastAZippedParser(fileName);

            foreach (var seq in fap.Parse())
            {
                var accession = seq.ID.Split('|')[3];
                loadedGenomes[accession] = seq as Sequence;
                if (accession.Contains('.'))
                {
                    loadedGenomes[accession.Split('.')[0]] = seq as Sequence;
                }
            }
            //now to grab all the trees
            //var tree = TreeLoader.LoadTree(CONSTANTS.TREE_XML_FILE);
            var           tree          = TreeLoader.LoadTree();
            int           FailedTests   = 0;
            int           PassedTests   = 0;
            int           AmbiguousFail = 0;
            int           SharedPolys   = 0;
            int           UnSharedPolys = 0;
            HashSet <int> BadPositions  = new HashSet <int>();

            foreach (var node in tree.GetAllChildren())
            {
                //if (node.haplogroup.id != "J1c3g")
                //{ continue; }
                try
                {
                    //ignore empty and thousand genomes
                    if (!String.IsNullOrEmpty(node.haplogroup.AccessionId) &&
                        !node.haplogroup.AccessionId.StartsWith("NA") &&
                        !node.haplogroup.AccessionId.StartsWith("HG"))
                    {
                        var id = node.haplogroup.AccessionId;
                        if (id == "NC_012920")
                        {
                            continue;
                        }

                        var seq = loadedGenomes[id];
                        if (seq.Alphabet.HasAmbiguity)
                        {
                            //sw.WriteLine(node.haplogroup.id + "\t" + node.haplogroup.AccessionId + "\tAmbiguousSequence");
                            AmbiguousFail++;
                            continue;
                        }
                        //now check for differences
                        var origfoundPolys = NewSearchMethods.GenomeToHaploGrepConverter.FindPolymorphisms(seq).Where(x => !CONSTANTS.EXCLUDED_POSITIONS.Contains(x.position)).ToList();
                        var currentPolys   = node.Mutations.ToList();//copy
                        List <Polymorphism> removeLater = new List <Polymorphism>();
                        var foundPolys = origfoundPolys.ToList();
                        foreach (var poly in origfoundPolys)
                        {
                            if (currentPolys.Contains(poly))
                            {
                                SharedPolys++; currentPolys.Remove(poly); foundPolys.Remove(poly);
                            }
                        }
                        currentPolys.Sort((x, y) => x.position.CompareTo(y.position));
                        currentPolys = CONSTANTS.CommonPolymorphismFilter(currentPolys).ToList();
                        foundPolys   = CONSTANTS.CommonPolymorphismFilter(foundPolys).ToList();
                        if (currentPolys.Count > 0)// || foundPolys.Count > 0)
                        {
                            UnSharedPolys += currentPolys.Count + foundPolys.Count;
                            sw.WriteLine(node.haplogroup.id
                                         + "\t" + node.haplogroup.AccessionId
                                         + "\tMismatchedPolymorphisms"
                                         + "\t" + String.Join("-", foundPolys.Select(x => (object)x).ToArray())
                                         + "\t" + String.Join("-", currentPolys.Select(x => (object)x).ToArray())
                                         );
                            FailedTests++;
                            foreach (var v in foundPolys)
                            {
                                BadPositions.Add(v.position);
                            }
                            foreach (var v in currentPolys)
                            {
                                BadPositions.Add(v.position);
                            }
                        }
                        else
                        {
                            PassedTests++;
                        }
                    }
                }
                catch (Exception thrown)
                {
                    sw.WriteLine(node.haplogroup.id
                                 + "\t" + node.haplogroup.AccessionId
                                 + "\t" + thrown.Message);
                }
            }
            sw.Close();
            sw = new System.IO.StreamWriter("TestReport.txt");
            sw.WriteLine("Failed Tests\t" + FailedTests.ToString());
            sw.WriteLine("Passed Tests\t" + PassedTests.ToString());
            sw.WriteLine("Ambiguous Sequences\t" + AmbiguousFail.ToString());
            sw.WriteLine("Polymorphisms overlapping between genbank and haplogrep\t" + SharedPolys.ToString());
            sw.WriteLine("Not Overlapping\t" + UnSharedPolys.ToString());
            sw.WriteLine("Total Discordant Positions\t" + BadPositions.Count.ToString());
            sw.WriteLine("Bad Position Listing");
            var bps = BadPositions.ToList();

            bps.Sort();
            foreach (var bp in bps)
            {
                sw.WriteLine(bp.ToString());
            }
            sw.Close();
        }
Beispiel #27
0
 //Outputs
 public void OnPass()
 {
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnPass, I_O);
 }
Beispiel #28
0
 public void AddTexture(string imagename)
 {
     this.images.Add(Resources.Load(CONSTANTS.get("QUESTION_IMG") + imagename) as Texture2D);
 }
Beispiel #29
0
    // Update is called once per frame
    void Update()
    {
        //Blood effect
        if (Client_watcher.Singleton != null && Client_watcher.Singleton.isServer)
        {
            if (Time.realtimeSinceStartup > time_to_spawn_blood)//Spawn bleed reference real time to increase effect accuracy in slow mo
            {
                time_to_spawn_blood = Time.realtimeSinceStartup + CONSTANTS.BLOOD_SPAWN_INTERVAL;
                if (bleedFX_obj_list.Count > 1)
                {
                    short[] pox = new short[bleedFX_pos_list.Count * 2];
                    short[] ang = new short[bleedFX_angle_list.Count];
                    for (int i = 0; i < bleedFX_pos_list.Count; i++)
                    {
                        pox[i] = (short)(bleedFX_pos_list[i].x * CONSTANTS.SYNC_POS_MUTIPLIER);
                        pox[bleedFX_pos_list.Count + i] = (short)(bleedFX_pos_list[i].y * CONSTANTS.SYNC_POS_MUTIPLIER);
                        ang[i] = CONSTANTS.seed_float_to_short(bleedFX_angle_list[i], 360);
                    }

                    Client_watcher.Singleton.Rpc_spawn_blood(bleedFX_obj_list.ToArray(), pox, ang, bleedFX_isHS_list.ToArray());
                }
                else if (bleedFX_obj_list.Count == 1)
                {
                    bleedFX_obj_list[0].GetComponent <Body_generic>().Rpc_bleed(bleedFX_pos_list[0], bleedFX_angle_list[0], bleedFX_isHS_list[0]);
                }
                bleedFX_obj_list.Clear();
                bleedFX_pos_list.Clear();
                bleedFX_angle_list.Clear();
                bleedFX_isHS_list.Clear();
            }
        }

        //Polygonal fluid effect
        if (particleSystems.Count == 0)
        {
            mesh.Clear();
            return;
        }
        List <Vector3> vertices_list  = new List <Vector3>();
        List <Color>   colors_list    = new List <Color>();
        List <int>     triangles_list = new List <int>();
        int            triangle_gap   = 0;
        int            reference      = 0;

        for (int x = 0; x < particleSystems.Count; x++)
        {
            ParticleSystem PS = particleSystems[x];
            if ((PS == null) || (!PS.isPlaying && PS.particleCount == 0))
            {
                particleSystems.RemoveAt(x);
                continue;
            }
            //draw
            if (PS.particleCount > 3)
            {
                //Debug.Log("burn");
                ParticleSystem.Particle[] particles = new ParticleSystem.Particle[PS.particleCount];
                PS.GetParticles(particles);

                //flame Fx

                int vertices_count = particles.Length;
                particles = particles.OrderBy(o => o.remainingLifetime).ToArray();

                for (int i = 0; i < vertices_count; i++)
                {
                    Color color = mesh_color;


                    float mean = 0;
                    if (i < particles.Length - 2)
                    {
                        mean = (Vector2.Distance(particles[i].position, particles[i + 1].position) + Vector2.Distance(particles[i].position, particles[i + 2].position) + Vector2.Distance(particles[i + 1].position, particles[i + 2].position)) / 3;
                    }
                    else if (i < particles.Length - 1)
                    {
                        mean = Vector2.Distance(particles[i].position, particles[i + 1].position);
                    }

                    color.a = (CONSTANTS.FLAME_TRI_STANDARD_DIST / mean) * particles[i].remainingLifetime / particles[i].startLifetime;
                    colors_list.Add(color);
                    Vector3 pos = particles[i].position;
                    pos.z = CONSTANTS.FX_Z;
                    vertices_list.Add(pos);
                }

                for (int i = 0; i < vertices_count - 2; i++)
                {
                    if (Mathf.Abs(particles[i].remainingLifetime - particles[i + 2].remainingLifetime) > merge_threshold)
                    {
                        triangles_list.Add(0 + triangle_gap);
                        triangles_list.Add(0 + triangle_gap);
                        triangles_list.Add(0 + triangle_gap);
                    }
                    else
                    {
                        triangles_list.Add(i + triangle_gap);
                        triangles_list.Add(i + 1 + triangle_gap);
                        triangles_list.Add(i + 2 + triangle_gap);
                        if (reference < i + 2 + triangle_gap)
                        {
                            reference = i + 2 + triangle_gap;
                        }
                    }
                }
                triangle_gap += vertices_count;
            }
        }
        mesh.Clear();
        mesh.vertices  = vertices_list.ToArray();
        mesh.triangles = triangles_list.ToArray();
        mesh.colors    = colors_list.ToArray();
        mesh.RecalculateNormals();
    }
Beispiel #30
0
 public void OnIgnited()
 {
     CONSTANTS.invokeOutput(CONSTANTS.OUTPUT_NAME.OnIgnited, I_O);
 }