Exemplo n.º 1
0
    /// <summary>
    /// Sets the part and class type types based on parameters, then instantiates it within the grave.
    /// </summary>
    /// <param name="_pt"> The part type to add </param>
    /// <param name="_ct"> The Class type to add </param>
    public void SetBodyPart(Part_Type _pt, Class_Type _ct)
    {
        switch (_pt)
        {
        case Part_Type.head:
            m_bodyPart = m_head;
            break;

        case Part_Type.left_arm:
            m_bodyPart = m_leftArm;

            break;

        case Part_Type.right_arm:
            m_bodyPart = m_rightArm;

            break;

        case Part_Type.left_leg:
            m_bodyPart = m_leftLeg;

            break;

        case Part_Type.right_leg:
            m_bodyPart = m_rightLeg;

            break;

        case Part_Type.torso:
            m_bodyPart = m_torso;

            break;

        default:
            Debug.LogError("_pt was incorrectly formatted. Output was: " + _pt.ToString());
            break;
        }

        m_bodyPart = Instantiate(m_bodyPart);
        ///Test/debug
        //   m_bodyPart = GameObject.CreatePrimitive(PrimitiveType.Cube);
        ///set the new body part to the position of this gameobject
        m_bodyPart.transform.position = transform.position;
        //m_bodyPart.AddComponent<BodyPart>();
        //m_bodyPart.AddComponent<Interactable>();
        //m_bodyPart.AddComponent<Throwable>();

        m_bodyPart.GetComponent <BodyPart>().m_class_Type = _ct;
        Rigidbody rb = m_bodyPart.GetComponent <Rigidbody>();

        //     rb.useGravity = false;
        //     rb.constraints = RigidbodyConstraints.FreezeAll;
        //     m_bodyPart.GetComponent<BodyPart>().m_part_Type = _pt;
        //     m_bodyPart.GetComponent<BodyPart>().m_class_Type = _ct;
        m_bodyPart.transform.SetParent(transform);
        m_bodyPart.SetActive(false);


        m_bodyPart.name = "Body Part: " + m_bodyPart.GetComponent <BodyPart>().m_part_Type + " (" + m_bodyPart.GetComponent <BodyPart>().m_class_Type + ")";
    }
Exemplo n.º 2
0
        public Character(String fname, Stats fstats, Content.Class_info fcinfo, Class_Type ftype)
        {
            stats = fstats;

            init(fname, fcinfo, ftype);

            pos = new Point(-1, -1);
        }
Exemplo n.º 3
0
    /// <summary>
    /// Sets up each grave with a class and part type and adds text to the gravestone
    /// </summary>
    private void Setup()
    {
        int counter = 0;

        int _knightCounter = 0;
        int _bersCounter   = 0;
        int _thiefCounter  = 0;

        foreach (GameObject go in m_graveSpots)
        {
            Grave      _grave      = go.GetComponentInChildren <Grave>();
            Gravestone _gravestone = go.GetComponentInChildren <Gravestone>();
            int        _idx        = UnityEngine.Random.Range(0, Enum.GetValues(typeof(Part_Type)).Length);

            Part_Type _pt = (Part_Type)_idx;
            int       idx = UnityEngine.Random.Range(0, Enum.GetValues(typeof(Class_Type)).Length);

            Class_Type _ct = (Class_Type)idx;
            switch (_ct)
            {
            case Class_Type.berserker:
                _bersCounter++;
                counter = _bersCounter;
                break;

            case Class_Type.knight:
                _knightCounter++;
                counter = _knightCounter;

                break;

            case Class_Type.thief:
                _thiefCounter++;
                counter = _thiefCounter;

                break;
            }
            ///Debug
            //    _ct = Class_Type.knight;
            ///Set text on grave
            string _ctName = _ct.ToString();

            string query     = $"(//*[@id='FriendlyUnits']//*[@id='{_ctName}']//*[@id='GraveText'])[{counter}]";
            string graveText = XMLManager.Instance.ReadSingleNodeData(query);

            if (graveText == null)
            {
                Debug.LogError("text not found for: " + _ctName + " dummy text set.");
                graveText = "Dummy Text for: " + _ctName;
            }

            _gravestone.SetCanvasText(graveText);

            ///Add body part to grave
            _grave.SetBodyPart(_pt, _ct);
        }
    }
Exemplo n.º 4
0
        public Character(String fname, Content.Class_info fcinfo, Class_Type ftype)
        {
            stats=new Stats();

            stats.traits = fcinfo.start;

            init(fname, fcinfo, ftype);

            calcStat();

            stats.hp = stats.maxHp;
            stats.mana = stats.maxMana;

            pos = new Point(-1, -1);
        }
Exemplo n.º 5
0
 private void init(String fname, Content.Class_info fcinfo, Class_Type ftype)
 {
     type = ftype;
     name = fname;
     level = 1;
     exp = 0;
     org = "";
     cinfo = fcinfo;
     equipment = new Equipment();
 }
Exemplo n.º 6
0
 /// <summary>
 /// Generates (derp) names based on class
 /// </summary>
 /// <param name="ctype"></param>
 /// <returns></returns>
 public static String genName(Class_Type ctype)
 {
     if (ctype == Class_Type.ARCHER)
         return "Huang Zhong";
     else if (ctype == Class_Type.CASTER)
         return "Medea";
     else if (ctype == Class_Type.FIGHTER)
         return "Adon";
     else if (ctype == Class_Type.HEALER)
         return "Glanis";
     else if (ctype == Class_Type.SCOUT)
         return "Blainey";
     else
         return "Frei";
 }
Exemplo n.º 7
0
        /// <summary>
        /// Generates a Character that is of the given class
        /// </summary>
        /// <param name="ctype">Class of the generated Character</param>
        /// <param name="name">Name of the Character</param>
        /// <returns>Character of the given class or null if class type incorrect</returns>
        public static Character genClass(Class_Type ctype, String name)
        {
            Character c;

            if (ctype == Class_Type.ARCHER)
                c = new Archer(name);
            else if (ctype == Class_Type.CASTER)
                c = new Caster(name);
            else if (ctype == Class_Type.FIGHTER)
                c = new Fighter(name);
            else if (ctype == Class_Type.HEALER)
                c = new Healer(name);
            else if (ctype == Class_Type.SCOUT)
                c = new Scout(name);
            else
                c = null;

            return c;
        }