Exemplo n.º 1
0
 public override void GetDamage(float damage, TurretShot whoHit)
 {
     //if reached number of enemies aiming to this enemy, get damage
     if (turretsAiming.Length >= numberOfTurretsWhoMustAim)
     {
         base.GetDamage(damage, whoHit);
     }
 }
Exemplo n.º 2
0
    public int AddTurret(F3DFXType turret, Transform[] socket)
    {
        TurretShot shot = new TurretShot();

        shot.prefab  = GetPrefab(turret);
        shot.sockets = socket;

        turrets.Add(shot);
        return(turrets.Count - 1);
    }
Exemplo n.º 3
0
    void Shoot()
    {
        GameObject turretShot   = (GameObject)Instantiate(shotPrefab, firePoint.position, firePoint.rotation);
        TurretShot turretBullet = turretShot.GetComponent <TurretShot>();

        if (turretBullet != null)
        {
            turretBullet.Seek(target);
        }
    }
Exemplo n.º 4
0
    protected virtual void Attack()
    {
        //create shot (pool, position, rotation, scale, init)
        TurretShot shot = shots.Instantiate(shotPrefab, shotSpawns[indexSpawn].position, shotSpawns[indexSpawn].rotation);
        float      size = GameManager.instance.world.worldConfig.CellsSize;

        shot.transform.localScale = new Vector3(size, size, size);
        shot.Init(this, EnemyToAttack);

        //call event
        onShoot?.Invoke(shotSpawns[indexSpawn]);

        //cycle between spawns
        indexSpawn = indexSpawn < shotSpawns.Length - 1 ? indexSpawn + 1 : 0;
    }
Exemplo n.º 5
0
    public virtual void GetDamage(float damage, TurretShot whoHit)
    {
        //invoke event
        onGetDamage?.Invoke();

        //get damage
        health -= damage;

        //check death
        if (health <= 0)
        {
            Die(whoHit);
            return;
        }
    }
Exemplo n.º 6
0
    public override void GetDamage(float damage, TurretShot whoHit)
    {
        //if aiming at this one and its soulbind, get damage
        if (turretsAiming.Length > 0 && (soulBind == null || soulBind.turretsAiming.Length > 0))
        {
            base.GetDamage(damage, whoHit);

            //if share health, damage also soulbind (only if damageSoulBind is true)
            if (soulBind && shareHealth && damageSoulBind)
            {
                soulBind.damageSoulBind = false;
                soulBind.GetDamage(damage, whoHit);
                soulBind.damageSoulBind = true;
            }
        }
    }
Exemplo n.º 7
0
    public override void GetDamage(float damage, TurretShot whoHit)
    {
        base.GetDamage(damage, whoHit);

        //check if teleport
        if (CheckTeleport() == false)
        {
            return;
        }

        //get new random face to teleport and save previous position
        EFace randomFace = WorldUtility.GetRandomFace(facesQueue, numberOfPreviousFacesToIgnore);

        //find coordinates where teleport
        Coordinates newCoordinates = GetNewCoordinates(randomFace);

        if (newCoordinates != null)
        {
            //save distance
            float distance = Vector3.Distance(transform.position, coordinatesToAttack.position);

            //get new position and rotation
            Vector3    position;
            Quaternion rotation;
            GameManager.instance.world.GetPositionAndRotation(newCoordinates, distance, out position, out rotation);

            //call event
            onTeleport?.Invoke(transform.position, transform.rotation, position, rotation);

            transform.position  = position;         //new coordinates, but same distance
            transform.rotation  = rotation;         //new rotation looking at cube
            coordinatesToAttack = newCoordinates;   //attack this new coordinates
        }
        //kill if there are no coordinates
        else
        {
            Die(this);
        }
    }