/// <summary>
    /// Currently creates and displays the prefab.
    /// If the manager has one create of the same type of IconLocObject
    /// If will reset that one
    ///
    /// Returns the newly set iconlocobject
    ///
    /// Duration of -1 means that the icon will last until its object is gone
    /// </summary>
    protected IconLocObject DrawIcon(float duration = -1)
    {
        FUI2dLocManager ILM = FUI2dLocManager.GetLM;

        if (ILM == null)
        {
            Debug.LogWarning("FUI2dLocManager has not been created yet");
            return(null);
        }
        else
        {
            // Debug.LogWarning("**** "+gameObject.name + " Going to spawn Icon");
            if (allowSpawn)
            {
                //cacheObject = null;
                cacheObject = ILM.CreateIcon(prefab, SpawnType, isTarget3D, this.gameObject, duration);
                if (cacheObject != null)
                {
                    isDrawn = true;
                    return(cacheObject);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
    }
    // Use this for initialization
    void Awake()
    {
        // set the instance of me
        _manager = this;


        Init();
    }
示例#3
0
    new public bool Init(FUI2dLocManager locManager, FUI2dLocManager.IconLocObjectTypes type, GameObject target, bool target3d, float dur)
    {
        Debug.LogWarning("Init from IconLocCannon.cs");


        bool isInit = false;

        isInit = base.Init(locManager, type, target, target3d, dur);

        if (!isInit)
        {
            // we failed, return false;
            return(isInit);
        }
        else
        {
            isInit = false;             // reset to false
            // test to see if we have cannon
            isInit = SetCannon();
        }

        return(isInit);
    }
    /// <summary>
    /// Initialized this object from the Manager
    /// </param>
    /// </summary>
    public bool Init(FUI2dLocManager locManager, FUI2dLocManager.IconLocObjectTypes type, GameObject target, bool target3d, float dur)
    {
        if (target == null)
        {
            Debug.LogError("Trying to init IconLocObject with invalid Target");
            return(false);
        }

        myManager   = locManager;
        _type       = type;
        _target     = target;
        _isTarget3d = target3d;
        duration    = dur;


        _isActive = true;

        // using NGUI Tools to make sure the entire object and children are active.
        // Deactive will not make the parent and children gameobject inactive
        Activate();
        // NGUITools.SetActive(this.gameObject, _isActive);

        return(_isActive);
    }