コード例 #1
0
        /// <summary>
        /// Print the object's XML to the XmlWriter.
        /// </summary>
        /// <param name="objWriter">XmlTextWriter to write with.</param>
        /// <param name="objCulture">Culture in which to print</param>
        public async ValueTask Print(XmlWriter objWriter, CultureInfo objCulture)
        {
            if (objWriter == null)
            {
                return;
            }
            // <initiationgrade>
            XmlElementWriteHelper objBaseElement = await objWriter.StartElementAsync("initiationgrade");

            try
            {
                await objWriter.WriteElementStringAsync("guid", InternalId);

                await objWriter.WriteElementStringAsync("grade", Grade.ToString(objCulture));

                await objWriter.WriteElementStringAsync("group", Group.ToString(GlobalSettings.InvariantCultureInfo));

                await objWriter.WriteElementStringAsync("ordeal", Ordeal.ToString(GlobalSettings.InvariantCultureInfo));

                await objWriter.WriteElementStringAsync("schooling", Schooling.ToString(GlobalSettings.InvariantCultureInfo));

                await objWriter.WriteElementStringAsync("technomancer", Technomancer.ToString(GlobalSettings.InvariantCultureInfo));

                if (GlobalSettings.PrintNotes)
                {
                    await objWriter.WriteElementStringAsync("notes", Notes);
                }
            }
            finally
            {
                // </initiationgrade>
                await objBaseElement.DisposeAsync();
            }
        }
コード例 #2
0
    void SchoolingBehavior()
    {
        GameObject[] school = SchoolGlobals.school;

        Vector3 center       = new Vector3(0, 0, 0);
        Vector3 avoid        = new Vector3(0, 0, 0);
        float   school_speed = 0.1f;

        Vector3 target = SchoolGlobals.target;
        float   dist   = 0;
        int     size   = 0;

        // for each fish:
        // check distance between this fish and other fish
        // if within bounds of what the school radius should be,
        // we include that fish in the school
        foreach (GameObject g in school)
        {
            //if (size > 8) break;
            if (g != this.gameObject)
            {
                dist = Vector3.Distance(g.transform.position, transform.position);
                if (dist <= school_dist && size < 8)
                {
                    center += g.transform.position;
                    size++;
                    if (dist < 30.0f)
                    {
                        avoid += (transform.position - g.transform.position);
                    }

                    Schooling other = g.GetComponent <Schooling>();
                    school_speed += other.speed;
                }
            }
        }

        // once we've found all fish within appropriate radius, we lead them towards the radius
        if (size > 0)
        {
            center /= size;
            center += (target - transform.position);
            speed   = school_speed / size;
            if (speed >= 20f)
            {
                speed = 19f;
            }

            Vector3 dir = (center + avoid) - transform.position;
            if (dir != new Vector3(0, 0, 0))
            {
                transform.rotation = Quaternion.Slerp(transform.rotation,
                                                      Quaternion.LookRotation(dir),
                                                      rot_speed * Time.deltaTime);
            }
        }
    }
コード例 #3
0
    public void Awake()
    {
        fishControl = GetComponent<FishControl>();
        fishMove = GetComponent<FishMove>();
        schooling = GetComponent<Schooling>();
        updateTimer = UnityEngine.Random.Range(0.0f, updateInterval);

        hit = new RaycastHit();
    }
コード例 #4
0
    public void Awake()
    {
        fishControl = GetComponent<FishControl>();

        fishMove = GetComponent<FishMove>();
        schooling = GetComponent<Schooling>();
        updateTimer = UnityEngine.Random.Range(0.0f, UpdateInterval);

        GL_OctreeRenderer.AddRenderDelegate(GL_Draw);
    }
コード例 #5
0
ファイル: InitiationGrade.cs プロジェクト: skeetcha/chummer5a
 /// <summary>
 /// Print the object's XML to the XmlWriter.
 /// </summary>
 /// <param name="objWriter">XmlTextWriter to write with.</param>
 /// <param name="strLanguageToPrint">Language in which to print</param>
 public void Print(XmlTextWriter objWriter, string strLanguageToPrint)
 {
     objWriter.WriteStartElement("initiationgrade");
     objWriter.WriteElementString("grade", Grade.ToString());
     objWriter.WriteElementString("group", Group.ToString());
     objWriter.WriteElementString("ordeal", Ordeal.ToString());
     objWriter.WriteElementString("schooling", Schooling.ToString());
     objWriter.WriteElementString("technomancer", Technomancer.ToString());
     if (_objOptions.PrintNotes)
     {
         objWriter.WriteElementString("notes", Notes);
     }
     objWriter.WriteEndElement();
 }
コード例 #6
0
 /// <summary>
 /// Print the object's XML to the XmlWriter.
 /// </summary>
 /// <param name="objWriter">XmlTextWriter to write with.</param>
 /// <param name="objCulture">Culture in which to print</param>
 public void Print(XmlTextWriter objWriter, CultureInfo objCulture)
 {
     if (objWriter == null)
     {
         return;
     }
     objWriter.WriteStartElement("initiationgrade");
     objWriter.WriteElementString("grade", Grade.ToString(objCulture));
     objWriter.WriteElementString("group", Group.ToString(GlobalOptions.InvariantCultureInfo));
     objWriter.WriteElementString("ordeal", Ordeal.ToString(GlobalOptions.InvariantCultureInfo));
     objWriter.WriteElementString("schooling", Schooling.ToString(GlobalOptions.InvariantCultureInfo));
     objWriter.WriteElementString("technomancer", Technomancer.ToString(GlobalOptions.InvariantCultureInfo));
     if (_objCharacter.Options.PrintNotes)
     {
         objWriter.WriteElementString("notes", Notes);
     }
     objWriter.WriteEndElement();
 }