Esempio n. 1
0
    void Update()
    {
        if (target != null)
        {
            Vector3 displacementVector = target.transform.position - transform.position;
            this.selfbody.velocity = (displacementVector).normalized * Mathf.Max(trackingSpeed, displacementVector.magnitude);

            if (Vector3.Distance(transform.position, target.transform.position) < 0.3f)
            {
                Destroy(this.gameObject);

                //Adds bomb
                ShmupPlayer player = target.GetComponent <ShmupPlayer>();
                if (player != null)
                {
                    player.GainBomb(this.chargeValue);
                }
            }
        }

        timer += Time.deltaTime;
        if (timer > DECAY_WARNING_TIME)
        {
            SetColor(Color.grey);
        }
        if (timer > MAX_PERSIST_TIME)
        {
            Destroy(this.gameObject);
        }
    }
Esempio n. 2
0
 private void Start()
 {
     if (player == null)
     {
         player = ShmupGameManager.instance.player;
     }
     lastBombCount = (int)player.bombCharge;
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        spawnPoints = levels[0].GetSpawnPoints();
        player      = FindObjectOfType <ShmupPlayer>();
        player.gameObject.SetActive(false);

        dialogComponent.SetActive(true);

        StartLevel();
    }
Esempio n. 4
0
    void OnTriggerEnter2D(Collider2D col)
    {
        print("eh");
        ShmupPlayer p = col.GetComponent <ShmupPlayer>();

        if (p != null && !byPlayer)
        {
            p.HitByBullet(isFire);
            Destroy(gameObject);
        }
        else
        {
            Enemy e = col.GetComponent <Enemy>();
            if (e != null && byPlayer)
            {
                e.HitByBullet(isFire);
                Destroy(gameObject);
            }
        }
    }