Ejemplo n.º 1
0
    /// <summary>
    /// Change the stats based of parents
    /// </summary>
    /// <param name="Parents"></param>
    public void Born(DataCubeBrain[] Parents)
    {
        int _Speedindex   = Mathf.RoundToInt(Random.Range(0, Parents.Length));
        int _Defenseindex = Mathf.RoundToInt(Random.Range(0, Parents.Length));
        int _DataType     = Mathf.RoundToInt(Random.Range(0, Parents.Length));

        if (Parents != null)
        {
            Speed    = Parents[_Speedindex].Speed;
            Defense  = Parents[_Defenseindex].Defense;
            DataCube = Parents[_DataType].DataCube;
        }

        float futureMb      = 0;
        float futureProcess = 0;

        foreach (DataCubeBrain i in Parents)
        {
            futureMb      += i.m_CurrentMB;
            futureProcess += i.m_CurrentProcess;
        }
        m_CurrentMB      = futureMb / Parents.Length;
        m_CurrentProcess = futureProcess / Parents.Length;
        m_MatingData     = new DataCubeMatingData
        {
            NeededCurrentMB = Random.Range(1, EnitiyManager.instance.DataCubeSettings.m_MaxMb),
            NeededProcess   = Random.Range(1, EnitiyManager.instance.DataCubeSettings.m_MaxProcess),
        };
        m_Steering.SetSpeed(Speed);
    }