public virtual Destructable CalculateTarget(GameObject[] targets)
    {
        Destructable closestTarget = null;
        var          d             = float.MaxValue;

        foreach (var tar in targets)
        {
            Destructable destr = tar.GetComponent <Destructable>();

            if (destr == null)
            {
                continue;
            }

            if (!CanAttack(tar))
            {
                continue;
            }

            var dd = Vector3.Distance(tar.transform.position, transform.position);
            if (dd < d)
            {
                closestTarget = destr;
                d             = dd;
            }
        }
        return(closestTarget);
    }
示例#2
0
    void OnHit(Vector3 point, Vector3 normal, Collider collider)
    {
        // damage
        Destructable dest = collider.GetComponent <Destructable>();

        if (dest)
        {
            dest.OnDie();
        }

        // impact vfx
        if (impactVFX)
        {
            GameObject impactVFXInstance = Instantiate(impactVFX, point + (normal * impactVFXSpawnOffset), Quaternion.LookRotation(normal));
            if (impactVFXLifetime > 0)
            {
                Destroy(impactVFXInstance.gameObject, impactVFXLifetime);
            }
        }

        // impact sfx
        if (impactSFXClip)
        {
            AudioUtility.CreateSFX(impactSFXClip, point, AudioUtility.AudioGroups.Impact, 1f, 3f);
        }

        // Self Destruct
        Destroy(this.gameObject);
    }
示例#3
0
    void Shoot()
    {
        _muzzleFlash.SetActive(true);
        currentAmmo--;
        _uiManager.UpdateAmmo(currentAmmo);

        if (_weaponAudio.isPlaying == false)
        {
            _weaponAudio.Play();
        }

        Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrigin, out hitInfo))
        {
            Debug.Log(hitInfo.transform.name);
            Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));

            Destructable crate = hitInfo.transform.GetComponent <Destructable>();
            if (crate != null)
            {
                crate.DestroyCrate();
            }
        }
    }
示例#4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Enemy") && !isInvincible)
        {
            Destructable otherScript = null;
            GameObject   parent      = other.gameObject;
            while (true)
            {
                if (parent.GetComponent <Destructable>())
                {
                    otherScript = parent.GetComponent <Destructable>();
                    break;
                }

                parent = parent.transform.parent.gameObject;
            }

            otherScript.InflictDamage(collisionDamage);
            InflictDamage(otherScript.GetCollisionDamage());
        }

        if (other.gameObject.CompareTag("Asteroid"))
        {
            if (this is AutoTurretController && !(this is OrbitingTurretController) && ((AutoTurretController)this).isAttached)
            {
                PlayerController.instance.GetComponent <PlayerController>().addMass(10);

                other.gameObject.SetActive(false);
            }
        }
    }
示例#5
0
    void Shoot()
    {
        _muzzleFlash.SetActive(true);
        _currentAmmo--;
        _uiManager.UpdateAmmo(_currentAmmo);

        if (!_weaponAudio.isPlaying)
        {
            _weaponAudio.Play();
        }

        // 0.5F to get the middle of the viewport - which is where the crosshair is
        Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
        RaycastHit hitInfo;

        // hit input will be output --> whatever the raycast hit
        if (Physics.Raycast(rayOrigin, out hitInfo))
        {
            Debug.Log("Hit: " + hitInfo.transform.name);
            // we want the prefab effect to be from the perpendicular normal
            // IE: if it's a person standing, the effect needs to come facing out
            // not facing up. The Instantiated object needs to be type casted as GameObject
            GameObject hitMarker = Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal)) as GameObject;
            Destroy(hitMarker, 1f);

            Destructable crate = hitInfo.transform.GetComponent <Destructable>();
            if (crate != null)
            {
                crate.DestroyCrate();
            }
        }
    }
示例#6
0
    void HouseDestruction()
    {
        //Initially we will make an array which searches through each object that is colliding with the player
        //within the specified bounderies, and then we will call another script in which we destroy the
        //original object and instantiate a broken version, then we search for colliders again, but this
        //time for the new destroyed buildings, and add force to them
        Collider[] collidersToDestroy = Physics.OverlapSphere(transform.position, destructionRadius);

        foreach (Collider nearbyObject in collidersToDestroy)
        {
            Destructable dest = nearbyObject.GetComponent <Destructable>();
            if (dest != null)
            {
                dest.Destroy();
                housesDestroyed++;
            }
        }

        Collider[] collidersToMove = Physics.OverlapSphere(transform.position, destructionRadius);

        foreach (Collider nearbyObject in collidersToMove)
        {
            Rigidbody rb = nearbyObject.GetComponent <Rigidbody>();
            if (rb != null)
            {
                rb.AddExplosionForce(explosionForce, transform.position, destructionRadius);
            }
        }
    }
示例#7
0
    void OnTriggerEnter(Collider other)
    {
        if (owner != null)
        {
            if (other.gameObject == owner && !canDamageOwner)
            {
                return;
            }
        }

        Debug.Log(other.transform.root.tag);

        Destructable health = other.transform.root.GetComponent <Destructable>();

        if (health == null)
        {
            return;
        }

        health.TakeDamage(damage);
        used++;

        if (uses == 0) //0 means unlimted
        {
            return;
        }

        if (used >= uses)
        {
            Destroy(gameObject);
        }
    }
示例#8
0
 private void Update()
 {
     if (target == null)
     {
         target = FindObjectsOfType <Destructable>().Where(x => x.enabled && x.GetTeam() != destructableSelf.GetTeam()).FirstOrDefault();
         if (target != null)
         {
             RaycastHit hitInfo;
             if (Physics.Raycast(transform.position, target.transform.position - transform.position, out hitInfo))
             {
                 GetComponent <Walker>().SetDestination(hitInfo.point);
             }
             else
             {
                 GetComponent <Walker>().SetDestination(target.transform.position);
             }
         }
         else
         {
             GetComponent <Walker>().SetDestination(null);
         }
     }
     else
     {
         if (GetComponent <Walker>().Arrived() && attackCoroutine == null)
         {
             attackCoroutine = StartCoroutine(Attack());
         }
     }
 }
示例#9
0
    void PlayerShot()
    {
        muzzelFlash.SetActive(true);
        currentAmmo--;
        uiManager.UpdateAmmo(currentAmmo);
        if (!weaponAudio.isPlaying)
        {
            weaponAudio.Play();
        }

        Ray        rayOrgin = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrgin, out hitInfo))
        {
            Debug.Log("Raycast hit something " + hitInfo.transform.name);
            GameObject hitMarker = Instantiate(hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal)) as GameObject;
            Destroy(hitMarker, 1.0f);

            Destructable crate = hitInfo.transform.GetComponent <Destructable>();
            if (crate != null)
            {
                crate.DestroyCrate();
            }
        }
    }
示例#10
0
    void Shoot()
    {
        currentAmmo--;
        _muzzleFlash.SetActive(true);
        if (!_weaponAudio.isPlaying)
        {
            _weaponAudio.Play();
        }
        Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrigin, out hitInfo, Mathf.Infinity))
        {
            Debug.Log("Hit: " + hitInfo.transform.name);
            GameObject hitMarker = (GameObject)Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));
            Destroy(hitMarker, 1f);

            if (hitInfo.transform.name == "Wooden_Crate")
            {
                Destructable crate = hitInfo.transform.GetComponent <Destructable>();
                if (crate != null)
                {
                    crate.DestroyCrate();
                }
            }
        }
    }
示例#11
0
    void OnShoot()
    {
        RaycastHit hit;

        if (Physics.Raycast(fpsCamera.transform.position, fpsCamera.transform.forward, out hit))
        {
            Destructable    destruct = hit.transform.GetComponent <Destructable>();
            TargetBehaviour target   = hit.transform.GetComponent <TargetBehaviour>();

            if (target != null)
            {
                target.TakeDamage();
            }
            else if (destruct != null)
            {
                destruct.TakeDamage();
            }

            else
            {
                GameObject shoot = Instantiate(shootingEffect, hit.point, Quaternion.LookRotation(hit.normal));
                Destroy(shoot, 0.1f);
            }

            if (hit.rigidbody != null)
            {
                hit.rigidbody.AddForce(hit.normal * addForce);
            }
        }
    }
示例#12
0
    private void OnTriggerStay(Collider other)
    {
        IDamageable <int> damageable = other.GetComponentInParent <IDamageable <int> >();
        PlayerController  player     = other.GetComponentInParent <PlayerController>();

        if (damageable != null)
        {
            if (player == null)
            {
                damageable.TakeDamage(damage);
            }
            else
            {
                Vector3 direction = (player.transform.position - transform.position).normalized;
                player.Blast(direction, force);
            }
        }

        Destructable destructable = other.GetComponent <Destructable>();

        if (destructable != null)
        {
            Destroy(other.gameObject);
        }

        Destroy(gameObject);
    }
示例#13
0
 public override void WriteData(ESPWriter writer)
 {
     if (EditorID != null)
     {
         EditorID.WriteBinary(writer);
     }
     if (ObjectBounds != null)
     {
         ObjectBounds.WriteBinary(writer);
     }
     if (Name != null)
     {
         Name.WriteBinary(writer);
     }
     if (Model != null)
     {
         Model.WriteBinary(writer);
     }
     if (Script != null)
     {
         Script.WriteBinary(writer);
     }
     if (Destructable != null)
     {
         Destructable.WriteBinary(writer);
     }
     if (MarkerFlags != null)
     {
         MarkerFlags.WriteBinary(writer);
     }
 }
示例#14
0
    private void Shoot()
    {
        _weapon.Fire();

        _muzzelFlash.SetActive(true);

        Ray        originRay = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hitInfo;

        if (Physics.Raycast(originRay, out hitInfo))
        {
            print("Hit: " + hitInfo);

            GameObject newHitMarker = Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));

            Destroy(newHitMarker, 1f);

            Destructable crate = hitInfo.transform.GetComponent <Destructable>();

            if (crate != null)
            {
                crate.DestroyCrate();
            }
        }
    }
示例#15
0
    void Shoot()
    {
        if (_hasGun)
        {
            currentAmmo--;
            _uiManager.UpdateAmmo(currentAmmo);
            if (!_gunSound.isPlaying)
            {
                _gunSound.Play();
            }
            _muzzleFlash.SetActive(true);
            Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
            RaycastHit hitInfo;
            if (Physics.Raycast(rayOrigin, out hitInfo))
            {
                GameObject hitMarker = Instantiate(_hitMarker, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));
                Destroy(hitMarker, 0.3f);

                Destructable crate = hitInfo.transform.gameObject.GetComponent <Destructable>();
                if (crate != null)
                {
                    crate.DestroyCrate();
                }
            }
        }
    }
示例#16
0
    void Shoot()
    {
        muzzleFlash.SetActive(true);
        currentAmmo--;
        uiManager.UpdateAmmo(currentAmmo);

        if (!weaponAudio.isPlaying)
        {
            weaponAudio.Play();
        }

        Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(.5f, .5f, 0));
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrigin, out hitInfo))
        {
            Debug.Log("RayCast Hit " + hitInfo.transform.name + "!");
            GameObject hitMarker = Instantiate(hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal)) as GameObject;
            Destroy(hitMarker, 0.5f);

            // If we hit any destructable
            Destructable destructable = hitInfo.transform.GetComponent <Destructable>();
            if (destructable)
            {
                destructable.DestroyObject();
            }
        }
    }
示例#17
0
    private void Shoot()
    {
        _muzzleFlash.SetActive(true);
        if (!_audioSource.isPlaying)
        {
            _audioSource.Play();
        }
        _currentAmmo -= 1;
        _UIManager.UpdateAmmo(_currentAmmo);
        Vector3 centerPosition = new Vector3(0.5f, 0.5f, 0);

        Ray        rayOrigin = Camera.main.ViewportPointToRay(centerPosition);
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrigin, out hitInfo))
        {
            Debug.Log($"You hit {hitInfo.transform.name}");

            var lookRotation = Quaternion.LookRotation(hitInfo.normal);

            GameObject hitMarker = Instantiate(_hitMarkerPrefab, hitInfo.point, lookRotation);

            Destroy(hitMarker, 0.5f);

            // check if hit a crate
            // destroy crate

            Destructable crate = hitInfo.transform.GetComponent <Destructable>();

            if (crate != null)
            {
                crate.DestroyCrate();
            }
        }
    }
示例#18
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.transform.parent.tag == "Player")
        {
            return;
        }

        Collectable collectable = collider.transform.parent.GetComponent <Collectable> ();

        if (collectable != null)
        {
            collectable.Collect();
        }
        else
        {
            Destructable destructable = collider.transform.parent.GetComponent <Destructable> ();

            if (destructable != null)
            {
                destructable.Destruct();
            }
        }

        Destroy(gameObject);
    }
示例#19
0
 void OnDestructableDestroy_Handler(Destructable destructable)
 {
     if (photonView.IsMine)
     {
         //CurrentAmmo += destructable.AmmoReward;
     }
 }
示例#20
0
    // Use this for initialization
    void Start()
    {
        terrain_manager = terrain_manager_game_object.GetComponent <TerrainManager>();

        start_time      = Time.time;
        completion_time = start_time - 1f;

        race_car.transform.position = terrain_manager.myInfo.start_pos;
        race_car.transform.rotation = Quaternion.identity;

        Random.InitState(random_seed);
        for (int i = 0; i < number_of_turrets; i++)
        {
            Vector3 pos = terrain_manager.myInfo.GetRandomFreePos();
            pos.y = 2f;
            //turret_list.Add(Instantiate(turret, pos, Quaternion.identity));
            turret_clone                    = Instantiate(turret, pos, Quaternion.identity);
            destructable_script             = (Destructable)turret_clone.GetComponent(typeof(Destructable));
            destructable_script.is_weak     = weak_turrets;
            gatlinggun_script               = (GatlingGun)turret_clone.GetComponent(typeof(GatlingGun));
            gatlinggun_script.is_long_range = long_range_turrets;
            turret_list.Add(turret_clone);
        }

        for (int i = 0; i < number_of_extra_cars; i++)
        {
            Vector3 pos = new Vector3(185f, 0, 135 + 10 * i);
            pos.y = 2f;
            turret_list.Add(Instantiate(race_car, pos, Quaternion.identity));
        }
    }
示例#21
0
    void Shoot()
    {
        _muzzleFlash.SetActive(true);
        currentAmmo--;
        _uiManager.UpdateAmmo(currentAmmo);
        // if audio not playing
        // play audio
        if (_weaponAudio.isPlaying == false)
        {
            _weaponAudio.Play();
        }
        Ray        rayOrgions = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrgions, out hitInfo))
        {
            Debug.Log(message: "RayCast Hit: " + hitInfo.transform.name);
            GameObject hitMarker = Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal)) as GameObject;
            Destroy(hitMarker, 1f);

            // check if we hit the crate
            Destructable crate = hitInfo.transform.GetComponent <Destructable>();
            if (crate != null)
            {
                crate.DestroyCrate();
            }
            // Destroy Crate
        }
    }
示例#22
0
    void Shoot()
    {
        Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hitInfo;

        currentAmmo--;
        _uiManager.UpdateAmmo(currentAmmo);

        if (!_weaponAudio.isPlaying)
        {
            _weaponAudio.Play();
        }

        _muzzleFlash.SetActive(true);

        if (Physics.Raycast(rayOrigin, out hitInfo))
        {
            if (!hitInfo.collider.isTrigger)
            {
                Debug.Log("Hit: " + hitInfo.transform.name);
                GameObject hitMarker = Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal)) as GameObject;
                Destroy(hitMarker, 1.0f);

                Destructable crate = hitInfo.transform.GetComponent <Destructable>();
                if (crate)
                {
                    crate.DestroyCrate();
                }
            }
        }
    }
示例#23
0
    void Shoot()
    {
        if (_canFire && Time.time >= _timeToFire && _weapon.activeSelf)
        {
            _timeToFire = Time.time + _firePause;
            _currentAmmo--;
            if (!_audioSource.isPlaying)
            {
                _audioSource.Play();
            }
            _muzzleFire.SetActive(true);
            Ray        rayOrign = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
            RaycastHit hitInfo;
            _uiManager.UpdateAmmo(_currentAmmo, _totalAmmo);

            if (Physics.Raycast(rayOrign, out hitInfo))
            {
                Debug.Log("Hit: " + hitInfo.transform.name);
                GameObject hitMarker = Instantiate(_hitMarkerPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));
                Destroy(hitMarker, 0.3f);

                Destructable crate = hitInfo.transform.GetComponent <Destructable>();
                if (crate != null)
                {
                    crate.DestroyCreate();
                }
            }
        }
    }
示例#24
0
    void Explode()
    {
        Instantiate(explosionEffect, transform.position, transform.rotation);

        Collider[] collidersToDestroy = Physics.OverlapSphere(transform.position, radius);

        foreach (Collider nearbyObject in collidersToDestroy)
        {
            Destructable dest = nearbyObject.GetComponent <Destructable>();

            if (dest != null)
            {
                dest.Destroy();
            }
        }

        Collider[] collidersToMove = Physics.OverlapSphere(transform.position, radius);

        foreach (Collider nearbyObject in collidersToMove)
        {
            Rigidbody rb = nearbyObject.GetComponent <Rigidbody>();
            if (rb != null)
            {
                rb.AddExplosionForce(force, transform.position, radius);
            }
        }

        Destroy(gameObject);
    }
示例#25
0
 public override void WriteData(ESPWriter writer)
 {
     if (EditorID != null)
     {
         EditorID.WriteBinary(writer);
     }
     if (ObjectBounds != null)
     {
         ObjectBounds.WriteBinary(writer);
     }
     if (Name != null)
     {
         Name.WriteBinary(writer);
     }
     if (Model != null)
     {
         Model.WriteBinary(writer);
     }
     if (Destructable != null)
     {
         Destructable.WriteBinary(writer);
     }
     if (Unknown != null)
     {
         Unknown.WriteBinary(writer);
     }
     if (Sound != null)
     {
         Sound.WriteBinary(writer);
     }
 }
示例#26
0
    private void Shoot()
    {
        if (Input.GetMouseButton(0) && _currentAmmo > 0)
        {
            _currentAmmo--;
            _uImanager.UpdateAmmo(_currentAmmo);
            _muzzleFlash.SetActive(true);
            if (_weaponAudio.isPlaying == false)
            {
                _weaponAudio.Play();
            }
            Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
            RaycastHit hitInfo;
            if (Physics.Raycast(rayOrigin, out hitInfo))
            {
                Debug.Log(hitInfo.transform.name);
                GameObject hitmarker = (GameObject)Instantiate(_hitMarker, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));

                Destroy(hitmarker, 1.0f);

                Destructable crate = hitInfo.transform.GetComponent <Destructable>();
                if (crate != null)
                {
                    crate.DestroyCrate();
                }
            }
        }
        else
        {
            _muzzleFlash.SetActive(false);
            _weaponAudio.Stop();
        }
    }
示例#27
0
    void Shoot()
    {
        _muzzleFlash.SetActive(true);
        currentAmo--;
        _uiManager.UpdateAmmo(currentAmo);
        //if audio is noit playing
        //play audio
        if (!_shootSound.isPlaying)
        {
            _shootSound.Play();
        }

        Ray        rayOrigin = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrigin, out hitInfo))
        {
            GameObject hitMarker = Instantiate(_hitMarketPrefab, hitInfo.point, Quaternion.LookRotation(hitInfo.normal));
            Destroy(hitMarker, 1.5f);

            //check if we hit the crate
            Destructable crate = hitInfo.transform.GetComponent <Destructable>();
            if (crate != null)
            {
                //Destroy crate
                crate.DestroyCrate();
            }
        }
    }
    void Update()
    {
        if (backingInfo is Destructable)
        {
            Destructable d = backingInfo as Destructable;
            updateHealthbar(d);
            float damageFraction = d.health / d.maxHealth;

            if (d.health <= 0)
            {
                map.removeStructure(this);
            }

            spriteRenderer.color = new Color(1, damageFraction, damageFraction);
        }

        if (backingInfo is Updateable)
        {
            Updateable u = backingInfo as Updateable;
            u.OnUpdate();
        }

        if (backingInfo is ChargableStructure)
        {
            updatePowerbar(backingInfo as ChargableStructure);
        }
    }
示例#29
0
    void OnTriggerEnter(Collider collider)
    {
        EntityOLD entity = collider.gameObject.GetComponentInParent <EntityOLD>();

        if (entity != null)
        {
            if (entity.IsVulnerable() && (targets.Contains(entity) || damageAny == true))
            {
                if (entity.GetComponent <AIController>() != null)
                {
                    entity.TriggerEventDamagedByEntity(originEntity);
                }
                entity.ModifyHealth(-damage);
                entity.CommandSufferPushback(originEntity.transform.position);
            }
        }

        else
        {
            Destructable destructable = collider.gameObject.GetComponent <Destructable>();

            if (destructable != null)
            {
                destructable.Damage(damage);
            }
        }
    }
示例#30
0
    public void OnTriggerEnter2D(Collider2D col)
    {
        Entity       e = col.GetComponent <Entity> ();
        Destructable d = col.GetComponent <Destructable> ();

        if (col.tag == "indes")
        {
            OnHit(col);
            OnDeath();
        }
        else if (e != null)
        {
            if (faction != e.getFaction())
            {
                OnEntHit(col, e);
                if (destroyOnHit)
                {
                    OnDeath();
                }
            }
        }
        else if (d != null)
        {
            OnHit(col);
        }
    }
示例#31
0
文件: Player.cs 项目: GSDan/TheOuse
    public override void Attack(Destructable target)
    {
        Anim.SetBool("Attacking", true);
        attacking = true;
        StartCoroutine(AttackDelay(AttackCooldown));

        GameObject projectile = (GameObject)Instantiate(ProjectilePrefab, ProjectilePoint.position, Quaternion.identity);
        Projectile proj = projectile.GetComponent<Projectile>();

        proj.Speed = (transform.localScale.x > 0) ? proj.Speed : -proj.Speed; 

    }
        public DestructableObject(Destructable destructable, Vector2 tileCoord)
        {
            if (destructable == Destructable.Vase)
            {
                texture = GameManager.TheGameManager.Content.Load<Texture2D>(Path.Textures.Misc + "vases");
                Random r = GameManager.TheGameManager.Random;
                sourceRectangle = new Rectangle(0, 0, 32, 64);
                localBounds = new Rectangle(0, 0, 0, 64);
                Team = Enumerations.Team.None;

                Data.setCurrent(GameObjectAttribute.HP, 1);
                Data.setCurrent(GameObjectAttribute.Level, 1);
            }

            Position = GameManager.TheGameManager.Map.TileCoordToPosition(tileCoord) + new Vector2(16, 50);
        }
示例#33
0
 public override void Attack(Destructable target)
 {
     target.Damage(AttackPower * Time.deltaTime);
     Anim.SetBool("Attacking", true);
 }
示例#34
0
 void Awake()
 {
     hp = GetComponent<Destructable>();
 }
示例#35
0
文件: Unit.cs 项目: GSDan/TheOuse
 public abstract void Attack(Destructable target);