Exemple #1
0
    public bool CallConstruct()
    {
        var possiblities = GameController.instance.GetEnemiesByType(EnemyTypes.Mechanic);

        possiblities.Sort(ClosestDistanceSort);
        bool hasFoundOne = false;

        if (possiblities.Count > 0)
        {
            foreach (AllyController ally in possiblities)
            {
                if (ally.GetAvailability)
                {
                    BuilderController b = ally.GetComponent <BuilderController>();

                    if (b != null)
                    {
                        b.SetConstruction(realObject, transform);
                        hasFoundOne = true;
                        break;
                    }
                }
            }
            // if (!hasFoundOne)
            //  possiblities[0].GetComponent<BuilderController>().SetConstruction(realObject, transform.position);
        }
        Destroy(gameObject);
        return(hasFoundOne);
    }