예제 #1
0
    public override void Initialize()
    {
        //get animations
        anim = GetComponent <Animator>();

        if (GetComponent <NavMeshAgent>())
        {
            agent = GetComponent <NavMeshAgent>();
        }

        for (int i = 0; i < anim.runtimeAnimatorController.animationClips.Length; i++)
        {
            if (anim.runtimeAnimatorController.animationClips[i].name.Contains("Attack"))
            {
                attacksName.Add(anim.runtimeAnimatorController.animationClips[i].name);
                attacksPos.Add(i);
            }
        }
        //add shootpoints
        foreach (Transform sp in transform.Find("ShootPoints"))
        {
            shootPoints.Add(sp);
        }

        stockpile = GameObject.Find("Bullets").GetComponent <BulletStockpile>();
        stockpile.AddBullet(bulletPrefab.name, bullets, 0.1f, bulletSpeed, transform.parent.parent.name);

        cam = Camera.main.gameObject;
    }
예제 #2
0
 //get stuff
 public override void Initialize()
 {
     cam       = Camera.main.gameObject;
     aim       = transform.GetChild(0).gameObject;
     stockpile = GameObject.Find("Bullets").GetComponent <BulletStockpile>();
     stockpile.AddBullet(bulletPrefab.name, bullets, firerate, bulletSpeed, transform.parent.parent.name);
     defaultTimer = firerate;
 }
예제 #3
0
    public override void Initialize()
    {
        gm = GameObject.Find("GameManager").GetComponent <GameManager>();

        cam    = Camera.main.gameObject;
        player = GameObject.Find("Player");
        aim    = transform.GetChild(0).gameObject;
        if (GameObject.Find("Bullets").GetComponent <BulletStockpile>())
        {
            stockpile = GameObject.Find("Bullets").GetComponent <BulletStockpile>();
            stockpile.AddBullet(bulletPrefab.name, bullets, firerate, bulletSpeed, transform.parent.parent.name);
        }
        defaultTimer = firerate;
    }
예제 #4
0
    ////////////////////////////////////////////////////////////////

    public void Initialize()
    {
        ////////////////////////////////////////////////////////////////

        shootPoints = transform.Find("ShootPoints");
        stockpile   = GameObject.Find("Bullets").GetComponent <BulletStockpile>();
        cam         = Camera.main.gameObject;
        anim        = GetComponent <Animator>();

        if (GetComponent <Collider>())
        {
            GetComponent <Collider>().enabled = false;
        }

        ////////////////////////////////////////////////////////////////
        // GET ATTACK ANIMATIONS
        ////////////////////////////////////////////////////////////////

        for (int i = 0; i < anim.runtimeAnimatorController.animationClips.Length; i++)
        {
            if (anim.runtimeAnimatorController.animationClips[i].name.Contains("Attack"))
            {
                attacksName.Add(anim.runtimeAnimatorController.animationClips[i].name);
                attacksPos.Add(i);
            }
        }

        ////////////////////////////////////////////////////////////////

        for (int i = 0; i < shootPoints.childCount; i++)
        {
            foreach (Transform sp in shootPoints.GetChild(i))
            {
                if (bullets.ContainsKey(bulletPrefabs[i].name))
                {
                    bullets[bulletPrefabs[i].name]++;
                }
                else
                {
                    bullets.Add(bulletPrefabs[i].name, 1);
                }
            }
            stockpile.AddBullet(bulletPrefabs[i].name, bullets[bulletPrefabs[i].name], firerate, bulletSpeed, transform.parent.parent.name);
        }

        ////////////////////////////////////////////////////////////////
    }
예제 #5
0
    public override void Initialize()
    {
        if (GameObject.Find("GameManager"))
        {
            gm = GameObject.Find("GameManager").GetComponent <GameManager>();
        }


        if (transform.parent.parent.Find("RoadWayPoints"))
        {
            wayPointParent     = transform.parent.parent.Find("RoadWayPoints");
            wayPointMax        = wayPointParent.childCount - 1;
            transform.position = wayPointParent.GetChild(0).position;
            transform.position = new Vector3(transform.position.x, transform.localScale.y / 2, transform.position.z);
            ableToGoForward    = true;
        }
        else
        {
            Debug.Log("No waypoints!");
        }


        if (GameObject.Find("Player"))
        {
            player = GameObject.Find("Player");
        }

        if (transform.childCount != 0)
        {
            aim = transform.GetChild(0).gameObject;
        }

        if (GameObject.Find("Bullets").GetComponent <BulletStockpile>())
        {
            stockpile = GameObject.Find("Bullets").GetComponent <BulletStockpile>();
            stockpile.AddBullet(bulletPrefab.name, bullets, firerate, bulletSpeed, transform.parent.parent.name);
        }

        cam = Camera.main.gameObject;
        default_ShootTimer = firerate;
    }
예제 #6
0
    ////////////////////////////////////////////////////////////////

    public override void Initialize()
    {
        ////////////////////////////////////////////////////////////////
        // GET STUFF
        ////////////////////////////////////////////////////////////////

        FindShootPoints(transform);

        //get animations
        anim = GetComponent <Animator>();
        for (int i = 0; i < anim.runtimeAnimatorController.animationClips.Length; i++)
        {
            if (anim.runtimeAnimatorController.animationClips[i].name.Contains("Attack"))
            {
                numberOfAttackAnims++;
            }
        }

        stockpile   = GameObject.Find("Bullets").GetComponent <BulletStockpile>();
        gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
        cam         = Camera.main.gameObject;

        ////////////////////////////////////////////////////////////////
        // ADD SHOOTPOINTS
        ////////////////////////////////////////////////////////////////

        foreach (Transform list in shootPoints)
        {
            foreach (Transform point in list)
            {
                points.Add(point);
            }
        }


        ////////////////////////////////////////////////////////////////
        // ADD BULLETS TO STOCKPILE
        ////////////////////////////////////////////////////////////////

        for (int i = 0; i < points.Count; i++)
        {
            foreach (Transform sp in points[i])
            {
                if (bullets.ContainsKey(bulletPrefabs[i].name))
                {
                    bullets[bulletPrefabs[i].name]++;
                }
                else
                {
                    bullets.Add(bulletPrefabs[i].name, 1);
                }
            }
        }

        ////////////////////////////////////////////////////////////////

        List <string> bulletsKeys = bullets.Keys.ToList();

        for (int i = 0; i < bulletPrefabs.Count; i++)
        {
            stockpile.AddBullet(bulletPrefabs[i].name, bullets[bulletPrefabs[i].name], 0.01f, bulletSpeeds[i], transform.parent.parent.name);
        }

        ////////////////////////////////////////////////////////////////
    }