예제 #1
0
    override protected void OnInstantiated(GameObject go)
    {
        GameUnit unit = Tools.FindInParents <GameUnit>(transform);

        if (unit != null)
        {
            SGHealthBar hb = go.GetComponentInChildren <SGHealthBar>();
            if (hb != null)
            {
                hb.unit = unit;
            }
        }

        PowerGenerator generator = Tools.FindInParents <PowerGenerator>(transform);

        if (generator != null)
        {
            SGPowerBar pb = go.GetComponentInChildren <SGPowerBar>();
            if (pb != null)
            {
                pb.generator = generator;
            }
        }

        SGTarget ut = go.GetComponent <SGTarget>();

        if (ut != null)
        {
            ut.target = transform;
            ut.range  = range;
        }
    }
예제 #2
0
    override protected void OnInstantiated(GameObject go)
    {
        SGTarget target = go.GetComponent <SGTarget>();

        if (target != null)
        {
            target.target = transform;
            target.range  = range;
        }
    }
예제 #3
0
    void Start()
    {
        mTrans     = transform;
        mBaseScale = mTrans.localScale;
        mTarget    = Tools.FindInParents <SGTarget>(mTrans);

        // Just in case we forget -- UITarget must be present on this game object or on one of the parents
        if (mTarget == null)
        {
            Debug.LogWarning(Tools.GetHierarchy(gameObject) + " needs a " + typeof(SGTarget) + " to work with");
        }

        // Starting rotation
        mOffset = mTrans.localRotation.eulerAngles.z;
    }