Exemplo n.º 1
0
    void DropPheromone(Pheromone.PheromoneType type, Vector3 target)
    {
        Pheromone pheromone = new Pheromone(type, target, this);

        m_WorldMatrix.DropPheromone(pheromone, gameObject.transform.position);
        ProcessPheromone(pheromone);
    }
Exemplo n.º 2
0
    private Vector3 GetAveragePheromonDirectionByType(Pheromone.PheromoneType pheromoneType)
    {
        Vector3 ans   = new Vector3(0, 0, 0);
        int     count = 0;

        foreach (GameObject pheromone in spottedPheromnes)
        {
            if (pheromone.GetComponent <Pheromone>().myPheromoneType == pheromoneType)
            {
                ans += new Vector3(pheromone.transform.forward.x, 0f, pheromone.transform.forward.z);
                count++;
            }
        }
        ans = ans.normalized;

        return(ans);
    }
Exemplo n.º 3
0
    private Vector3 GetAveragePheromonPointByType(Pheromone.PheromoneType pheromoneType)
    {
        Vector3 ans   = new Vector3(0, 0, 0);
        int     count = 0;

        foreach (GameObject pheromone in spottedPheromnes)
        {
            if (pheromone.GetComponent <Pheromone>().myPheromoneType == pheromoneType)
            {
                ans += new Vector3(pheromone.transform.position.x, 0f, pheromone.transform.position.z);
                count++;
            }
        }
        if (count > 0)
        {
            ans = new Vector3(ans.x / count, ans.y / count, ans.z / count);
        }



        return(ans);
    }