Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        timesHit = 0;

        animator = this.gameObject.GetComponent <Animator>();
        bow      = entity.equippedWeapon.GetComponent <Bow>();

        foreach (Transform child in GetComponentsInChildren <Transform>())
        {
            if (child.tag == "Weapon Spawn Point")
            {
                bow.Spawn(child);
                bow = bow.WeaponInstance.GetComponent <Bow>();
            }

            if (child.tag == "Arrow Spawn Point")
            {
                arrowSpawnPoint = child;
            }

            if (child.tag == "Projectile Launch Point")
            {
                projectileLaunchPoint = child;
            }
        }

        OnAttackInitiated.AddListener(delegate {
            // Set Projectile Target
            foreach (Transform child in attackTarget.GetComponentsInChildren <Transform>())
            {
                if (child.tag == "Projectile Target")
                {
                    projectileTarget = child;
                }
            }
        });
    }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        timesHit = 0;

        animator = this.gameObject.GetComponent <Animator>();
        grimiore = entity.equippedWeapon.GetComponent <Grimiore>();

        foreach (Transform child in GetComponentsInChildren <Transform>())
        {
            if (child.tag == "Weapon Spawn Point")
            {
                grimiore.Spawn(child);
                grimiore = grimiore.WeaponInstance.GetComponent <Grimiore>();
            }

            if (child.tag == "Casting Circle Target")
            {
                castingCircleTarget = child.gameObject;
            }

            if (child.tag == "Projectile Launch Point")
            {
                projectileLaunchPoint = child.gameObject;
            }
        }

        OnAttackInitiated.AddListener(delegate {
            // Set Proejctile Target
            foreach (Transform child in attackTarget.GetComponentsInChildren <Transform>())
            {
                if (child.tag == "Projectile Target")
                {
                    projectileTarget = child.gameObject;
                }
            }
        });
    }