Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        if (towerModel != null)
        {
            towerAnimatorController = towerModel.GetComponent <Animator>();
            if (towerAnimatorController != null)
            {
                towerAnimatorController.SetInteger("AnimState", 0);
            }
        }

        attackRangeCollider = GetComponent <SphereCollider>();
        enemiesInsideRadius = new List <Enemy>();
        towerData           = gameObject.GetComponent <TowerData>();

        placeableObject.OnChangeStateEvent += (placeableObject, state) =>
        {
            if (placeableObject.IsPlaced())
            {
                attackRangeCollider.enabled = true;
                if (towerAnimatorController != null)
                {
                    towerAnimatorController.SetInteger("AnimState", 1);
                }
            }
        };
    }