protected IDictionary <PhysicsU.Directions, ConductorCell_script> GetAttachedConductors()
    {
        IDictionary <PhysicsU.Directions, ConductorCell_script> ret      = new Dictionary <PhysicsU.Directions, ConductorCell_script>();
        IDictionary <PhysicsU.Directions, GameObject>           Coupleds = AnchorHub_script.GetCoupleds();

        foreach (KeyValuePair <PhysicsU.Directions, GameObject> e in Coupleds)
        {
            GameObject go = e.Value;

            ConductorCell_script conductor = go.GetComponent <ConductorCell_script>();
            if (conductor != null)
            {
                ret.Add(e.Key, conductor);
            }
        }
        return(ret);
    }
Ejemplo n.º 2
0
    private void PassFoodOn()
    {
        IDictionary <PhysicsU.Directions, GameObject> Coupleds = AnchorHub_script.GetCoupleds();
        int attachedCnt = AnchorHub_script.GetCoupledCount();

        int exess = GetExess();

        if (exess < 1)
        {
            return;
        }
        if (attachedCnt == 0)
        {
            return;
        }

        int give = Mathf.CeilToInt(exess / attachedCnt);

        foreach (KeyValuePair <PhysicsU.Directions, GameObject> e in Coupleds)
        {
            exess = GetExess();
            if (exess < 1)
            {
                return;
            }

            GameObject cell = e.Value;

            if (cell == null)
            {
                continue;
            }

            FeedCell(cell, give);
        }
    }