Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        player = FindObjectOfType <PlayerSolo>();
        Vector3 diff = (player.transform.position - transform.position);

        mag = (player.transform.position - transform.position).magnitude;
        float angle = Mathf.Atan2(diff.y, diff.x);

        transform.rotation = Quaternion.Euler(0f, 0f, (angle * Mathf.Rad2Deg) - 89.5f);

        if (mag <= 10)
        {
            transform.RotateAround(player.transform.position, new Vector3(0, 0, 1), rad * 5 * Time.deltaTime);
        }


        if (attackSpeed % (60 + r) == 0 && mag < 80 && Time.deltaTime > 0)
        {
            Instantiate(bulletPrefab, cannon.transform.position, cannon.transform.rotation);
            r = Random.Range(0, 120);
        }



        attackSpeed++;
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        animator = GetComponent <Animator>();
        player   = GetComponent <PlayerSolo>();
        player.SetMultiplierMaxTime(200);

        fire = false;
    }
Beispiel #3
0
    // Use this for initialization
    void Awake()
    {
        player   = FindObjectOfType <PlayerSolo>();
        animator = GetComponent <Animator>();

        r     = 0;
        speed = 0.2f;
        rad   = Random.Range(-2, 2);
    }
Beispiel #4
0
    private void SpawnPlayer()
    {
        playerSolo = FindObjectOfType <PlayerSolo>();

        if (playerSolo == null)
        {
            GameObject spawn = Instantiate(spawnPrefab, new Vector3(Random.Range(-15, 15), Random.Range(-7, 9), 0), Quaternion.Euler(0, 0, 0));
            playerSolo = Instantiate(playerPrefab, spawn.transform.position, Quaternion.Euler(0, 0, 0)).GetComponent <PlayerSolo>();
        }
    }
Beispiel #5
0
    // Use this for initialization
    void Awake()
    {
        rb = GetComponent <Rigidbody2D>();

        bulletSpeed = 1500f;

        rb.AddRelativeForce(new Vector2(0, bulletSpeed));

        player = FindObjectOfType <PlayerSolo>();
    }
Beispiel #6
0
    // Use this for initialization
    void Awake()
    {
        rb = GetComponent <Rigidbody2D>();

        bulletSpeed = 700f;

        rb.AddRelativeForce(new Vector2(0, bulletSpeed));

        player   = FindObjectOfType <PlayerSolo>();
        animator = FindObjectOfType <Animator>();

        explode = false;
    }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     animator = GetComponent <Animator>();
     player   = GetComponent <PlayerSolo>();
     player.SetMultiplierMaxTime(90);
 }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        player = FindObjectOfType <PlayerSolo>();

        transform.SetPositionAndRotation(new Vector3(player.transform.localPosition.x, player.transform.localPosition.y, -20), Quaternion.Euler(0, 0, 0));
    }
Beispiel #9
0
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType <PlayerSolo>();
 }