Beispiel #1
0
    private void Start()
    {
        Singleton = this;

        isShot = false;

        shoting = true;
    }
Beispiel #2
0
    void OnTriggerEnter2D(Collider2D hit)
    {
        FollowEnemy enemy = hit.GetComponent <FollowEnemy>(); //access the Following enemy's script

        if (enemy != null)                                    // if the bullet is not NULL/if the bullet hit something
        {
            enemy.TakeDamage(damage);                         // then take health from the enemy
        }
        Destroy(gameObject);                                  //then destroy the bullet
        ;
    }
    // Use this for initialization
    void Start()
    {
        //Os gameobjects a seguir sao inicializados para conseguir componentes de outros scripts utilizando
        //as variaveis ja declaradas.
        GameObject f = GameObject.Find ("bigcrush 1(Clone)/idle");
        fe = f.GetComponent<FollowEnemy> ();

        GameObject h = GameObject.Find ("Sihir");
        HPSihir = h.GetComponent<Hpsih> ();
        trs = GameObject.Find ("Sihir");
        Attack = h.GetComponent <SihirSounds> ();
    }
Beispiel #4
0
    void Shoot()
    {
        RaycastHit2D HitInfo = Physics2D.Raycast(FirePoint.position, FirePoint.right);

        //Instantiate(BulletPrefab, FirePoint.position, FirePoint.rotation);
        if (HitInfo)
        {
            FollowEnemy enemy = HitInfo.transform.GetComponent <FollowEnemy>(); //access the Following enemy's script
            if (enemy != null)                                                  // if the bullet is not NULL/if the bullet hit something
            {
                enemy.TakeDamage(damage);                                       // then take health from the enemy
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        //Os gameobjects a seguir sao inicializados para conseguir componentes de outros scripts utilizando
        //as variaveis ja declaradas.
        GameObject f = GameObject.Find("bigcrush 1(Clone)/idle");

        fe = f.GetComponent <FollowEnemy> ();

        GameObject h = GameObject.Find("Sihir");

        HPSihir = h.GetComponent <Hpsih> ();
        trs     = GameObject.Find("Sihir");
        Attack  = h.GetComponent <SihirSounds> ();
    }
Beispiel #6
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (target == null)
        {
            target = gameObject.GetComponent <FollowEnemy>().target;
        }

        if (target != null && Time.time - lastLaunchTime > timeBetweenLaunches && (target.transform.position - transform.position).magnitude < minLaunchDistance)
        {
            lastLaunchTime = Time.time;
            GameObject  missile       = GameObject.Instantiate(missilePrefab, transform.position, Quaternion.identity);
            FollowEnemy missileEntity = missile.GetComponent <FollowEnemy>();
            missileEntity.moveVector = gameObject.GetComponent <Entity>().moveVector;
            missileEntity.speed      = missileEntity.maxSpeed;
            missileEntity.target     = target;

            missileEntity.AvoidCollisions(gameObject.GetComponent <Entity>(), 2);
        }
    }