Ejemplo n.º 1
0
    public override void Awake()
    {
        base.Awake();

        _rushAttack   = GetComponent <RushAttack>();
        _damageSystem = GetComponent <DamageSystem>();
    }
Ejemplo n.º 2
0
    private void OnTriggerEnter(Collider other)
    {
        if (damageSafety)
        {
            return;
        }
        DamageSystem system = other.GetComponent <DamageSystem>();

        if (system == null || system == this.system)
        {
            return;
        }

        bool Deaded = system.IsDead;

        system.ApplyDamage(damage);

        if (system.IsDead != Deaded && FromParent)
        {
            GameStats.Kills++;
        }


        damageSafety = true;
        Destroy(this.gameObject);
    }
Ejemplo n.º 3
0
    private void OnTriggerEnter(Collider other)
    {
        DamageSystem system = other.GetComponent <DamageSystem>();

        if (system != null && system != self)
        {
            if (currentlyDamaged.Contains(system))
            {
                return;
            }


            currentlyDamaged.Add(system);


            if (EnableDamage)
            {
                //print("Bit " + other.transform.name);
                bool deaded = system.IsDead;
                system.ApplyDamage(this.Amount);
                if (this.isParentDamager && system.IsDead != deaded)
                {
                    GameStats.Kills++;
                }
            }
        }
    }
Ejemplo n.º 4
0
        public override ISyncScenarioItem Apply(CastContext castContext, int abilityLevel)
        {
            var effect = PrefabHelper.Intantiate(_explosionEffectPrefab, Game.Instance.gameObject);

            effect.transform.position   = castContext.Caster.Position;
            effect.transform.localScale = Vector3.zero;

            var radius  = _radius.GetValue(abilityLevel);
            var targets = MapController.Instance.GetEnemiesInArea(castContext.Caster.Position,
                                                                  radius, castContext.Caster.PlayerId);

            for (int i = 0; i < targets.Count; i++)
            {
                DamageSystem.ApplyDamage(castContext.Caster, _damage.GetValue(abilityLevel), targets[i]);
            }

            return(new SyncScenario(
                       new List <ISyncScenarioItem> {
                new ActionScenarioItem(() =>
                {
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Explosion");
                }),
                new AlphaTween(effect, 1),
                new ScaleTween(effect, 10 * radius * Vector3.one, 0.5f, EaseType.QuadIn),
                new AlphaTween(effect, 0, 0.3f, EaseType.QuadOut)
            },
                       (s, interrupted) => Object.Destroy(effect.gameObject)
                       ).PlayRegisterAndReturnSelf());
        }
Ejemplo n.º 5
0
        public PlayerBullet()
        {
            SpriteComponent spriteComponent = new SpriteComponent(this);

            spriteComponent.Image = Resources.PlayerBullet;
            AddComponent(spriteComponent);

            BoxCollider boxCollider = new BoxCollider(this);

            boxCollider.Size = spriteComponent.Image.Size;
            AddComponent(boxCollider);

            ScrollingComponent scrolling = new ScrollingComponent(this);

            scrolling.Speed        = 200f;
            scrolling.ScrollY      = true;
            scrolling.YAddNegative = true;
            AddComponent(scrolling);

            LimitLocationDelete limit = new LimitLocationDelete(this);

            AddComponent(limit);

            DamageSystem damageSystem = new DamageSystem(this);

            damageSystem.HitAbleTag = "Enemy";
            AddComponent(damageSystem);
        }
Ejemplo n.º 6
0
        public override ISyncScenarioItem Apply(CastContext castContext, int abilityLevel)
        {
            var linesCollider = PrefabHelper.Intantiate(_linesColliderPrefab, Game.Instance.gameObject);

            linesCollider.transform.position   = castContext.Caster.Position;
            linesCollider.transform.localScale = Vector3.one;
            linesCollider.OnTrigger           += (unit) =>
            {
                if (unit.PlayerId != castContext.Caster.PlayerId)
                {
                    DamageSystem.ApplyDamage(castContext.Caster, _damage.GetValue(abilityLevel), unit);
                }
            };
            var renderers = linesCollider.GetComponentsInChildren <Renderer>();

            return(new SyncScenario(
                       new List <ISyncScenarioItem> {
                new ActionScenarioItem(() =>
                {
                    FMODUnity.RuntimeManager.PlayOneShot("event:/Explosion");
                }),
                new AlphaTween(renderers, 0),
                new AlphaTween(renderers, 1, 0.1f, EaseType.QuadIn),
                new AlphaTween(renderers, 0, 0.3f, EaseType.QuadOut)
            },
                       (s, interrupted) => Object.Destroy(linesCollider.gameObject)
                       ).PlayRegisterAndReturnSelf());
        }
Ejemplo n.º 7
0
        public void CoreSetup(IMyRemoteControl remoteControl)
        {
            Logger.MsgDebug("Beginning Core Setup On Remote Control", DebugTypeEnum.BehaviorSetup);

            if (remoteControl == null)
            {
                Logger.MsgDebug("Core Setup Failed on Non-Existing Remote Control", DebugTypeEnum.BehaviorSetup);
                SetupFailed = true;
                return;
            }

            if (this.ConfigCheck == false)
            {
                this.ConfigCheck = true;
                var valA = RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("MTk1NzU4Mjc1OQ==")));
                var valB = RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("MjA0MzU0MzkyNQ==")));


                if (RAI_SessionCore.ConfigInstance.Contains(Encoding.UTF8.GetString(Convert.FromBase64String("LnNibQ=="))) && (!valA && !valB))
                {
                    this.BehaviorTerminated = true;
                    return;
                }
            }

            Logger.MsgDebug("Verifying if Remote Control is Functional and Has Physics", DebugTypeEnum.BehaviorSetup);
            this.RemoteControl            = remoteControl;
            this.CubeGrid                 = remoteControl.SlimBlock.CubeGrid;
            this.RemoteControl.OnClosing += (e) => { this.IsEntityClosed = true; };

            this.RemoteControl.IsWorkingChanged += RemoteIsWorking;
            RemoteIsWorking(this.RemoteControl);

            this.RemoteControl.OnClosing += RemoteIsClosing;

            this.CubeGrid.OnPhysicsChanged += PhysicsValidCheck;
            PhysicsValidCheck(this.CubeGrid);

            this.CubeGrid.OnMarkForClose += GridIsClosing;

            Logger.MsgDebug("Remote Control Working: " + IsWorking.ToString(), DebugTypeEnum.BehaviorSetup);
            Logger.MsgDebug("Remote Control Has Physics: " + PhysicsValid.ToString(), DebugTypeEnum.BehaviorSetup);
            Logger.MsgDebug("Setting Up Subsystems", DebugTypeEnum.BehaviorSetup);

            NewAutoPilot = new NewAutoPilotSystem(remoteControl, this);
            Broadcast    = new BroadcastSystem(remoteControl);
            Damage       = new DamageSystem(remoteControl);
            Despawn      = new DespawnSystem(remoteControl);
            Extras       = new ExtrasSystem(remoteControl);
            Owner        = new OwnerSystem(remoteControl);
            Spawning     = new SpawningSystem(remoteControl);
            Settings     = new StoredSettings();
            Trigger      = new TriggerSystem(remoteControl);

            Logger.MsgDebug("Setting Up Subsystem References", DebugTypeEnum.BehaviorSetup);
            NewAutoPilot.SetupReferences(this, Settings, Trigger);
            Damage.SetupReferences(this.Trigger);
            Damage.IsRemoteWorking += () => { return(IsWorking && PhysicsValid); };
            Trigger.SetupReferences(this.NewAutoPilot, this.Broadcast, this.Despawn, this.Extras, this.Owner, this.Settings, this);
        }
Ejemplo n.º 8
0
 void Start()
 {
     currentHp    = maxHp;
     healthUi     = gameObject.transform.Find("HealthBarContainer").GetComponent <PersonalHealthUI>();
     status       = GetComponent <Status>();
     damageSystem = GetComponent <DamageSystem>();
 }
        protected Dictionary <int, AbstractEntity> menuItemList = new Dictionary <int, AbstractEntity>(); // For when selecting item to pick up etc...

        public AbstractRoguelike(int maxLogEntries)
        {
            this.ecs     = new BasicEcs(this);
            this.mapData = new MapData();
            this.gameLog = new GameLog(maxLogEntries);

            new CloseCombatSystem(this.ecs);
            new MovementSystem(this.ecs, this.mapData);

            this.CreateData();

            this.view          = new DefaultRLView(this);
            this.drawingSystem = new DrawingSystem(this.view, this);

            this.checkVisibilitySystem = new CheckMapVisibilitySystem(this.ecs, this.mapData);
            new ShootOnSightSystem(this.ecs, this.checkVisibilitySystem, this.ecs.entities);

            this.checkVisibilitySystem.process(this.playersUnits);
            this.damageSystem    = new DamageSystem(this.ecs, this.gameLog);
            this.explosionSystem = new ExplosionSystem(this.ecs, this.checkVisibilitySystem, this.damageSystem, this.mapData, this.ecs.entities);
            new TimerCountdownSystem(this.ecs, this.explosionSystem);
            this.pickupItemSystem = new PickupDropSystem();
            this.effectsSystem    = new EffectsSystem(this.ecs);
            new ThrowingSystem(this.ecs, this.mapData, this.gameLog);
            new ShootingSystem(this.ecs, this.gameLog);

            // Draw screen
            this.drawingSystem.Process(this.effectsSystem.effects);
        }
	public override void Awake()
	{
		base.Awake();

		_rushAttack = GetComponent<RushAttack>();
		_damageSystem = GetComponent<DamageSystem>();
	}
Ejemplo n.º 11
0
 private void Start()
 {
     batsys  = gameObject.GetComponent <BattleSystem>();
     Lookimg = LookCard.GetComponent <Image>();
     rts     = Arrows.GetComponent <RectTransform>();
     ab      = gameObject.GetComponent <AnemyBattle>();
     ma      = gameObject.GetComponent <MobAnime>();
     csc     = gameObject.GetComponent <Cardsc>();
     Dm      = gameObject.GetComponent <DamageSystem>();
     Power   = Powergo.GetComponent <Text>();
     HP      = HPgo.GetComponent <Text>();
     SommonMonster[0].SetActive(false);
     SommonMonster[1].SetActive(false);
     SommonMonster[2].SetActive(false);
     Sommoned[0] = false;
     Sommoned[1] = false;
     Sommoned[2] = false;
     StatusNBuff[0].SetActive(false);
     StatusNBuff[1].SetActive(false);
     StatusNBuff[2].SetActive(false);
     BuffExp.SetActive(false);
     ons       = false;
     isOn      = false;
     Seleting  = false;
     isExplain = false;
     xpos      = 0f;
     Updating();
 }
Ejemplo n.º 12
0
    public void Inherit(DamageSystem other)
    {
        baseDamage       = other.baseDamage;
        damageMultiplier = other.damageMultiplier;
        targets          = other.targets;

        InitTargets();
    }
Ejemplo n.º 13
0
 public override ISyncScenarioItem Apply(CastContext castContext, int abilityLevel)
 {
     return(new ActionScenarioItem(() =>
     {
         DamageSystem.ApplyDamage(null, DamagePerTurn.GetValue(abilityLevel), castContext.Target);
     }
                                   ).PlayRegisterAndReturnSelf());
 }
Ejemplo n.º 14
0
	public void Inherit( DamageSystem other )
	{
		baseDamage = other.baseDamage;
		damageMultiplier = other.damageMultiplier;
		targets = other.targets;

		InitTargets();
	}
Ejemplo n.º 15
0
 private void Awake()
 {
     /* Global for player access */
     EnemyController.player = gameObject;
     weapon = GetComponent <SwordHandle>();
     rb     = GetComponent <Rigidbody>();
     damage = GetComponent <DamageSystem>();
     damage.register(this);
 }
Ejemplo n.º 16
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        IDamager damager = (IDamager)other.GetComponent(typeof(IDamager));

        if (damager != null)
        {
            DamageSystem.ApplyDamage(damager, controller.GetPlayer(), transform.position - other.transform.position);
        }
    }
Ejemplo n.º 17
0
 protected void BaseUnitInitialization()
 {
     orderableObject = GetComponent <OrderableObject>();
     fractionMember  = GetComponent <FractionMember>();
     agent           = GetComponent <NavMeshAgent>();
     damageSystem    = GetComponent <DamageSystem>();
     damageSystem.SetMaxHp(MaxHp);
     damageSystem.SetHpToMax();
 }
Ejemplo n.º 18
0
 protected override void InitSkill()
 {
     base.InitSkill();
     //连续技第二个
     if (originSkill != null && comboSkill == null)
     {
         int i = 0;
         foreach (var o in other)
         {
             if (o != null)
             {
                 var buff = o.GetComponent <CharacterStatus>().Buffs.Find(b => b.GetType() == typeof(DodgeBuff));
                 if (buff != null)
                 {
                     var b = (DodgeBuff)buff;
                     if (!b.done)
                     {
                         i++;
                     }
                 }
                 else
                 {
                     i++;
                 }
             }
         }
         if (i > 0)
         {
             animator.SetInteger("Skill", animID);
         }
         else
         {
             character.GetComponent <CharacterAction>().SetSkill("ChooseDirection");
             animator.applyRootMotion = false;
             skillState = SkillState.reset;
             return;
         }
     }
     foreach (var o in other)
     {
         if (comboSkill == null)
         {
             var comboUnits = DamageSystem.ComboDetect(character, o);
             if (comboUnits.Count > 0)
             {
                 foreach (var u in comboUnits)
                 {
                     var ninjaCombo = new NinjaCombo();
                     ninjaCombo.SetLevel(u.GetComponent <CharacterStatus>().skills["NinjaCombo"]);
                     comboUnitsOriginDirection.Add(u, u.forward);
                     u.forward = o.position - u.position;
                     u.GetComponent <Animator>().SetInteger("Skill", 1);
                 }
             }
         }
     }
 }
Ejemplo n.º 19
0
    void Start()
    {
        hpSysytem = gameObject.GetComponent<HPSysytem>();
        damageSystem = gameObject.GetComponent<DamageSystem>();

        enemyAnim = gameObject.GetComponent<EnemyAnimController>();

        FindHumans();
    }
Ejemplo n.º 20
0
 public void startSphere(float damage, float lifeTime, Vector3 momentum, DamageSystem parentSystem)
 {
     this.damage   = damage;
     this.lifeTime = lifeTime;
     this.momentum = momentum;
     this.system   = parentSystem;
     GetComponent <Rigidbody>().AddForce(momentum);
     lifeTimer = new Timer(lifeTime);
     lifeTimer.Start();
 }
Ejemplo n.º 21
0
    void OnTriggerEnter2D(Collider2D col)
    {
        DamageSystem damageSystem = col.GetComponent <DamageSystem>();

        if (transform.parent != col.transform.parent && damageSystem)
        {
            damageSystem.TakeDamage();
        }
        Destroy(gameObject);
    }
Ejemplo n.º 22
0
 private void FocousOnAttacker()
 {
     if (attackerEnemy != null)
     {
         focusedObject  = attackerEnemy;
         attackingEnemy = attackerEnemy;
         enemyGB        = attackerEnemy.GetComponent <GooseBehavious>();
         enemyDS        = enemyGB.damageSystem;
         focused        = true;
         attacking      = true;
     }
 }
Ejemplo n.º 23
0
    private void OnTriggerExit(Collider other)
    {
        DamageSystem system = other.GetComponent <DamageSystem>();

        if (system != null && system != self)
        {
            if (!currentlyDamaged.Contains(system))
            {
                return;
            }
            currentlyDamaged.Remove(system);
        }
    }
Ejemplo n.º 24
0
        public Enemy03()
        {
            Vec2D point = new Vec2D(-50, -50);

            transform.position = point;

            Tag = "Enemy";

            SpriteComponent spriteComponent = new SpriteComponent(this);

            spriteComponent.Image = Resources.Enemy_03_01;
            AddComponent(spriteComponent);

            AnimationSprite animationSprite = new AnimationSprite(this);

            animationSprite.ImageList.Add(Resources.Enemy_03_01);
            animationSprite.ImageList.Add(Resources.Enemy_03_02);
            AddComponent(animationSprite);

            BoxCollider boxCollider = new BoxCollider(this);
            Size        boxSize     = spriteComponent.Image.Size;

            boxSize.Width   -= 5;
            boxSize.Height  -= 5;
            boxCollider.Size = boxSize;
            AddComponent(boxCollider);

            HealthSystem healthSystem = new HealthSystem(this);

            healthSystem.Health = 3;
            AddComponent(healthSystem);

            DamageSystem damageSystem = new DamageSystem(this);

            damageSystem.HitAbleTag = "Player";
            AddComponent(damageSystem);

            BezierCurveMove bezierCurveMove = new BezierCurveMove(this);

            AddComponent(bezierCurveMove);

            EnemyBulletShooter enemyBulletShooter = new EnemyBulletShooter(this);

            enemyBulletShooter.ShootMinRotation = 177;
            enemyBulletShooter.ShootMaxRotation = 183;
            enemyBulletShooter.FireRate         = 2f;
            enemyBulletShooter.FireProbability  = 50;
            AddComponent(enemyBulletShooter);
        }
Ejemplo n.º 25
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (this.takeDamageFrom != null)
     {
         if (collision.gameObject.CompareTag(takeDamageFrom))
         {
             DamageSystem enemy = collision.gameObject.GetComponent <DamageSystem>();
             hp -= enemy.damageDealt;
             if (hp <= 0)
             {
                 death();
             }
         }
     }
 }
Ejemplo n.º 26
0
    void Explode(GameObject obj)
    {
        DamageSystem damageSystem = GetComponent <DamageSystem>();

        Collider[] collisions = Physics.OverlapSphere(transform.position, explosionRadius);
        foreach (Collider col in collisions)
        {
            if (damageSystem.IsTarget(col.tag))
            {
                DealDamage(col.gameObject);
            }
        }

        Instantiate(explosionEffect, transform.position, transform.rotation);
    }
Ejemplo n.º 27
0
    private void GetFirstEnemy()
    {
        currentGooseIndex = 0;

        for (; currentGooseIndex < gooseInRange.Count; currentGooseIndex++)
        {
            focusedObject = gooseInRange[currentGooseIndex];
            PlayerMain main = focusedObject.GetComponentInParent <PlayerMain>();;
            if (main != playerMainScript)
            {
                enemyGB = focusedObject.GetComponentInParent <GooseBehavious>();

                if (focusedObject != null && CanAttack(enemyGB))
                {
                    enemyDS = focusedObject.GetComponent <GooseEntity>().damageSystem;
                    enemyGB.attackerEnemy = gameObject;
                    enemyGB.beingAttacked = true;
                    attackingEnemy        = focusedObject;
                    attacking             = true;
                    //Debug.Log("got enemy DS");
                    focused = true;
                    navEle.thisAgent.speed = 3.5f;
                }
            }
            else
            {
                if (focusedObject != null)
                {
                    isAttackingPlayer = true;
                    attackingEnemy    = focusedObject;
                    attacking         = true;
                    //Debug.Log("got enemy DS");
                    focused = true;
                    navEle.thisAgent.speed = 3.5f;
                }
            }

            if (focused)
            {
                break;
            }
            else
            {
                enemyGB       = null;
                focusedObject = null;
            }
        }
    }
Ejemplo n.º 28
0
    protected override void OnSelectEntered(SelectEnterEventArgs args)
    {
        // Once select has occured, scale object to size
        var temp = args.interactable;

        if (temp is TwoHandGrabInteractable)
        {
            two = temp.GetComponent <TwoHandGrabInteractable>();
            two.canTakeByOther = true;

            if (temp.GetComponentInChildren <XRSimpleInteractable>())
            {
                simple         = temp.GetComponentInChildren <XRSimpleInteractable>();
                simple.enabled = false;
            }
        }
        else if (temp is XRItemGrabInteractable)
        {
            item = temp.GetComponent <XRItemGrabInteractable>();
            if (item.GetComponent <DamageSystem>())
            {
                ds         = item.GetComponent <DamageSystem>();
                ds.enabled = false;
            }
            item.canTakeByOther = true;
        }

        if (temp.GetComponentInChildren <XROffsetGrabInteractable>())
        {
            offsetGrab         = temp.GetComponentInChildren <XROffsetGrabInteractable>();
            offsetGrab.enabled = false;
        }
        if (temp.GetComponentInChildren <XRSocketInteractorWithName>())
        {
            socket = temp.GetComponentInChildren <XRSocketInteractorWithName>();
            if (socket.selectTarget)
            {
                var mag = socket.selectTarget.GetComponent <Magazine>();
                player.ammoCount += mag.ammoCount;
                player.SetText(mag.ammoCount, 1);
                Destroy(mag.gameObject);
            }
            socket.showInteractableHoverMeshes = false;
            socket.enabled = false;
        }
        base.OnSelectEntered(args);
        TweenSizeToSocket(temp);
    }
Ejemplo n.º 29
0
        public DungeonFactory(DungeonConfig dungeonConfig, EntitySpawner entitySpawner,
                              CharacterId heroId, List <SsarTuple <int, GameObject> > gateAndId,
                              DamageSystem damageSystem, PromiseWorld world, ConfigManager configManager)
        {
            notNullReference.Check(dungeonConfig, "dungeonConfig");
            notNullReference.Check(entitySpawner, "entitySpawner");
            notNullReference.Check(heroId, "heroId");
            notNullReference.Check(gateAndId, "gateAndId");
            notNullReference.Check(damageSystem, "damageSystem");
            notNullReference.Check(configManager, "configManager");

            heroAndMonsterConfig = configManager.GetConfig <HeroAndMonsterConfig>();
            defaultEnvironment   = new DefaultDungeonEnvironment(entitySpawner, gateAndId);
            this.dungeonConfig   = dungeonConfig;

            world.EntityCreationEventHandler += (sender, arg) =>
            {
                Entity entity = arg.Entity;
                if (arg.EntityType != EntityType.Creature)
                {
                    return;
                }

                if (entity.GetComponent <SkillComponent>().CharacterId.Equals(heroId))
                {
                    defaultEnvironment.SetHero(new DefaultDungeonCharacter(entity, damageSystem));
                }
            };

            damageSystem.EntityDeathEventHandler_Late += (sender, args) =>
            {
                CacheTemplateArgsComponent argsComponent = args.Entity.GetComponent <CacheTemplateArgsComponent>();
                SpawnSourceInfo            source        = argsComponent?.TemplateArgs.GetEntry <SpawnSourceInfo>(TemplateArgsName.SpawnSource) ?? new DungeonSystemSpawnSourceInfo();
                EntityRole role = args.Entity.GetComponent <StatsComponent>().BasicStatsFromConfig.ShowRole();
                defaultEnvironment.AddDeadMonster(new EntityMonster(Time.timeSinceLevelLoad,
                                                                    args.Entity.GetComponent <SkillComponent>().CharacterId, args.Entity.UniqueId, source, role));
            };

            entitySpawner.EntitySpawnEventHandler += (sender, args) =>
            {
                if (args.Entity.Group == EntityGroup.GROUP_A)
                {
                    return;
                }
                defaultEnvironment.AddSpawnedMonster(args.UniqueId, args.BasicStats, args.Entity);
            };
        }
Ejemplo n.º 30
0
    private bool _continueFiring;     //!< Used to enable some trickery to ensure the weapon fires continuously.

    void Awake()
    {
        _beam = GetComponent <LineRenderer>();

        // the beam should only ever have 2 vertexes
        _beam.SetVertexCount(2);

        // initialize the beam ray
        _ray   = new Ray();
        _audio = GetComponent <AudioSource>();

        // get a reference to the damage system attached to the weapon
        _damageSystem = GetComponent <DamageSystem>();

        _beamDuration   = duration;
        _continueFiring = false;
    }
Ejemplo n.º 31
0
	private bool _continueFiring; //!< Used to enable some trickery to ensure the weapon fires continuously.

	void Awake()
	{
		_beam = GetComponent<LineRenderer>();

		// the beam should only ever have 2 vertexes
		_beam.SetVertexCount( 2 );

		// initialize the beam ray
		_ray = new Ray();
		_audio = GetComponent<AudioSource>();

		// get a reference to the damage system attached to the weapon
		_damageSystem = GetComponent<DamageSystem>();

		_beamDuration = duration;
		_continueFiring = false;
	}
Ejemplo n.º 32
0
    private void ApplyExplode()
    {
        Collider2D[] objects = Physics2D.OverlapCircleAll(transform.position, fieldOfImpact, LayerToHit);

        foreach (Collider2D obj in objects)
        {
            Vector2    dir       = obj.transform.position - transform.position;
            IDamagable damagable = (IDamagable)obj.GetComponent(typeof(IDamagable));
            if (damagable != null)
            {
                DamageSystem.ApplyDamage(this.GetComponent <Enemy>(), damagable, dir);
            }
        }


        Destroy(gameObject);
    }
Ejemplo n.º 33
0
    void herir(Transform target)
    {
        if (target.transform.tag == tagDamage) {
            Debug.Log (target.transform.tag);
            ds = target.transform.GetComponent<DamageSystem> ();
            if (ds) {
                Debug.Log (tagDamage + ":" + damage);
                ds.hurt (damage);
                if (force > 0) {
                    var direction = target.transform.position - transform.position;
                    ds.GetComponent<Rigidbody2D>().AddForce (direction.normalized * force / 10, ForceMode2D.Impulse);

                }
            }

        }
    }
Ejemplo n.º 34
0
 void herir(Transform target)
 {
     if (target.transform.tag == tagDamage)
     {
         Debug.Log(target.transform.tag);
         ds = target.transform.GetComponent <DamageSystem>();
         if (ds)
         {
             ds.hurt(damage);
             if (force > 0)
             {
                 var direction = target.transform.position - transform.position;
                 ds.rigidbody2D.AddForce(direction.normalized * force / 10, ForceMode2D.Impulse);
             }
         }
     }
 }