Exemplo n.º 1
0
 void Start()
 {
     if (this.transform.root) {
         DamageManage = this.transform.root.GetComponent<DamageManager> ();
     } else {
         DamageManage = this.transform.GetComponent<DamageManager> ();
     }
 }
    protected virtual void Start()
    {
        noTrackOverride = false;
        GameObject managers = GameObject.FindGameObjectWithTag ("CustomManagers");
        damager = managers.GetComponent<DamageManager> ();

        player = GameObject.FindGameObjectWithTag ("Player");
        playerposlookup = player.GetComponent<PlayerDelayedPosition> ();
    }
 // Use this for initialization
 protected virtual void Start()
 {
     track = new BeatTracker ();
     assignTrack ();
     audioSource = GetComponent <AudioSource> ();
     anim = GetComponent <Animator> ();
     player = GameObject.FindGameObjectWithTag ("Player");
     GameObject managers = GameObject.FindGameObjectWithTag ("CustomManagers");
     damager = managers.GetComponent<DamageManager> ();
 }
Exemplo n.º 4
0
 // Use this for initialization
 void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
     }
     
     DontDestroyOnLoad(gameObject);
 }
Exemplo n.º 5
0
    void Start()
    {

        Me = this;
        TerrianManager = transform.FindChild("TerrainManager").GetComponent<TerrianManager>();
        SpawnManager = transform.FindChild("SpawnManager").GetComponent<SpawnManager>();
        TurnManager = transform.FindChild("TurnManager").GetComponent<TurnManager>();
        DamageManager = transform.FindChild("DamageAndScoreManager").GetComponent<DamageManager>();
        ScoreManager = transform.FindChild("DamageAndScoreManager").GetComponent<ScoreManager>();
        DestroyManager = transform.FindChild("DestroyManager").GetComponent<DestroyManager>();
        WeaponManager = transform.FindChild("WeaponsManager").GetComponent<WeaponsCombo>();
        ModesManager = transform.FindChild("ModesManager").GetComponent<ModesCombo>();
        MapsManager = transform.FindChild("MapManager").GetComponent<MapManager>();
        PlayerInfos = SpawnManager.GetComponent<PlayerInfo>();

        MapsManager.StartMap((MapManager.Maps) RoundManager.RandomMap);
        SpawnManager.Spawn(TanksStaringCount);
        TurnManager.Begin();
        Wind.StartWind();
        WeaponsClass.InitiallizeWeaponsQuantities();
        ModesClass.InitiallizeModesQuantities();

#if (!Debug)
        for (int i = 0; i < WeaponsClass.WeaponsQuantities.Count; i++)
            WeaponsClass.WeaponsQuantities[WeaponsClass.WeaponsQuantities.ElementAt(i).Key] = 99;

        for (int i = 0; i < ModesClass.ModesQuantities.Count; i++)
            ModesClass.ModesQuantities[ModesClass.ModesQuantities.ElementAt(i).Key] = 99;
#endif

        PlayerInfos.DrawPlayerInfoInUI_SinglePlayer();



        //begin clouds
        GameObject.Find("Cloud").GetComponent<Cload_Movement>().Begin();
        GameObject.Find("Cloud (1)").GetComponent<Cload_Movement>().Begin();
        GameObject.Find("Cloud (2)").GetComponent<Cload_Movement>().Begin();

        //
        GameObject.Find("UIButtons").GetComponent<UIButtonClick>().InitilizeButtons();

        //show round loadout
        GameObject fade = GameObject.Find("Fade");
        fade.GetComponent<Fade>().ShowLoadout();
        HideHUDS();
    }
Exemplo n.º 6
0
    IEnumerator GustPush()
    {
        yield return(new WaitForSeconds(.1f));

        triggered = true;
        for (int i = 0; i < monsters.Count; i++)
        {
            if (!monsters[i].GetComponent <Monster>().invulnerable)
            {
                int tempInt = DamageManager.MagicDamage(monsters[i], 35);
                monsters[i].GetComponent <Monster>().DamageMonster(tempInt);
                Instantiate(Resources.Load("Prefabs/SpellFX/Wind_Explode"), new Vector2(monsters[i].transform.position.x, monsters[i].transform.position.y), Quaternion.identity);

                StartCoroutine(monsters[i].GetComponent <Monster>().CustomSlideRoutine(2));
            }
        }
    }
Exemplo n.º 7
0
    public GameObject Spawn()
    {
        GameObject obj         = null;
        int        objectcount = ObjectSpawnedCount();

        indexSpawn = Random.Range(0, ObjectSpawn.Length);

        if (ObjectSpawn[indexSpawn] == null)
        {
            return(null);
        }

        if (objectcount < MaxObject)
        {
            if (SubSpawner.Length > 0)
            {
                int     s          = Random.Range(0, SubSpawner.Length);
                Vector3 spawnPoint = DetectGround(SubSpawner[s].transform.position + new Vector3(Random.Range(-(int)(SubSpawner[s].transform.localScale.x / 2.0f), (int)(SubSpawner[s].transform.localScale.x / 2.0f)), 0, Random.Range((int)(-SubSpawner[s].transform.localScale.z / 2.0f), (int)(SubSpawner[s].transform.localScale.z / 2.0f))));
                obj = UnitZ.gameNetwork.RequestSpawnObject(ObjectSpawn[indexSpawn].gameObject, spawnPoint, Quaternion.identity);
            }
            else
            {
                Vector3 spawnPoint = DetectGround(transform.position + new Vector3(Random.Range(-(int)(this.transform.localScale.x / 2.0f), (int)(this.transform.localScale.x / 2.0f)), 0, Random.Range((int)(-this.transform.localScale.z / 2.0f), (int)(this.transform.localScale.z / 2.0f))));
                obj = UnitZ.gameNetwork.RequestSpawnObject(ObjectSpawn[indexSpawn].gameObject, spawnPoint, Quaternion.identity);
            }

            if (obj)
            {
                DamageManager damagemanager = obj.GetComponent <DamageManager>();
                if (damagemanager != null && TeamConfig)
                {
                    damagemanager.Team = Team;
                }
                AICharacterShooterNav ai = obj.GetComponent <AICharacterShooterNav>();
                if (ai != null)
                {
                    if (Objectives != null && Objectives.Length > 0)
                    {
                        ai.ObjectiveTarget = Objectives[Random.Range(0, Objectives.Length)];
                    }
                }
                spawnList.Add(obj);
            }
        }
        return(obj);
    }
Exemplo n.º 8
0
    public void MeleeAttack(float range)
    {
        var dir = ai.Target.position - ai.Pos.position;
        var hit = Physics2D.Raycast(
            ai.Pos.position,
            dir,
            range,
            LayerMask.GetMask("Player Feet")
            );

        if (hit.collider != null)
        {
            var player = hit.collider.gameObject;
            DamageManager.DealDamage(player);
        }
        Task.current.Succeed();
    }
Exemplo n.º 9
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.gameObject.tag == "Wall")
        {
            Instantiate(Resources.Load("Prefabs/SpellFX/Venom_Explode"), new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
            Destroy(gameObject);
        }
        else if (other.gameObject.tag == "Enemy" && !isTriggered)
        {
            isTriggered = true;
            int tempInt = DamageManager.MagicDamage(other.gameObject, 25);
            other.gameObject.GetComponent <Monster>().DamageMonster(tempInt);
            Instantiate(Resources.Load("Prefabs/SpellFX/Venom_Explode"), new Vector2(transform.position.x, transform.position.y), Quaternion.identity);

            Destroy(gameObject);
        }
    }
Exemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     currentLevel      = 1;
     currentExperience = 0;
     maxExperience     = currentLevel * 100;
     sfxman            = FindObjectOfType <sfxManager>();
     dm  = FindObjectOfType <DamageManager>();
     phm = FindObjectOfType <PlayerHealthManager>();
     if (!exists)
     {
         exists = true;
         DontDestroyOnLoad(transform.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 11
0
        private void OnParticleCollision(GameObject particle)
        {
            if (Network.isServer)
            {
                if (particle.name.Equals("MainParticle"))
                {
                    Transform move = particle.transform;

                    while (move.parent.name != "Moves")
                    {
                        move = move.parent;
                    }

                    DamageManager man = move.GetComponent <DamageManager>();
                    man.HasCollided(gameObject);
                }
            }
        }
Exemplo n.º 12
0
        private void OnTriggerStay2D(Collider2D other)
        {
            if (other.CompareTag("Environment"))
            {
                other.GetComponent <Level.Environment>().DealDamage(AppModel.WeaponData().JetEngineDamage);
            }

            if (other.CompareTag("Enemy"))
            {
                var enemyController = other.GetComponent <EnemyController>();
                var direction       = Weapon.DegreeToVector2(transform.rotation.eulerAngles.z);
                if (Weapon.IsInverted)
                {
                    direction *= -1;
                }
                DamageManager.Hit(enemyController, Weapon, direction.normalized * AppModel.WeaponData().JetEngineImpulse);
            }
        }
Exemplo n.º 13
0
    public void ApplyHit(RootUnit target)
    {
        if ((target.unitID == wA.abilityOwner && wA.harmful && wA.selfHarm) || target.unitID != wA.abilityOwner)
        {
            DamageManager.CalculateAbilityDefender(target.unitID, wA);
        }

        if (wA.wEffectRunes != null)
        {
            foreach (var rune in wA.wEffectRunes)
            {
                if (rune.triggerTag == Rune.TriggerTag.OnHit)
                {
                    rune.Effect(target, GameWorldReferenceClass.GetUnitByID(wA.abilityOwner), wA);
                }
            }
        }
    }
Exemplo n.º 14
0
        public override void CreateVariables()
        {
            new SkinManager(8);

            Q.MinimumHitChance      = HitChance.Medium;
            W.AllowedCollisionCount = int.MaxValue;

            damageManager = new DamageManager
                            (
                new List <Bases.Damage>()
            {
                new Bases.Damage
                (
                    Q, DamageType.Magical, new float[] { 0, 80, 135, 190, 245, 300 },

                    new List <Scale>()
                {
                    new Scale(new float[] { 0, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f }, ScalingTypes.AP)
                }
                ),

                new Bases.Damage
                (
                    W, DamageType.Magical, new float[] { 0, 80, 160, 240, 320, 400 },

                    new List <Scale>()
                {
                    //The true value is 1.1f and not 0.8f, really ? 5 seconds on a tormented soil ?
                    new Scale(new float[] { 0, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f }, ScalingTypes.AP)
                }
                ),

                new Bases.Damage
                (
                    R, DamageType.Magical, new float[] { 0, 150, 225, 300 },

                    new List <Scale>()
                {
                    new Scale(new float[] { 0, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f }, ScalingTypes.AP)
                }
                )
            }
                            );
        }
Exemplo n.º 15
0
    IEnumerator FireSpinTick()
    {
        while (true)
        {
            triggered = false;
            yield return(new WaitForSeconds(1.5f));

            triggered = true;
            for (int i = 0; i < monsters.Count; i++)
            {
                if (!monsters[i].GetComponent <Monster>().invulnerable)
                {
                    int tempInt = DamageManager.MagicDamage(monsters[i], 30);
                    monsters[i].GetComponent <Monster>().DamageMonster(tempInt);
                    Instantiate(Resources.Load("Prefabs/SpellFX/Explode_1"), new Vector2(monsters[i].transform.position.x, monsters[i].transform.position.y), Quaternion.identity);
                }
            }
        }
    }
Exemplo n.º 16
0
    void DealDamage()
    {
        monsters.Clear();
        foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy"))
        {
            monsters.Add(enemy.gameObject);
        }


        for (int i = 0; i < monsters.Count; i++)
        {
            if (!monsters[i].GetComponent <Monster>().invulnerable)
            {
                int tempInt = DamageManager.MagicDamage(monsters[i], 95);
                monsters[i].GetComponent <Monster>().DamageMonster(tempInt);
                Instantiate(Resources.Load("Prefabs/SpellFX/Bubble_Pop"), new Vector2(monsters[i].transform.position.x, monsters[i].transform.position.y), Quaternion.identity);
            }
        }
    }
Exemplo n.º 17
0
 void OnTriggerEnter(Collider collider)
 {
     if (enemyAbilityStats.behavior == EnemyAbilityStats.Behavior.Projectile)
     {
         if (collider.gameObject.layer == 9)
         {
             Destroy(gameObject);
         }
         var target = collider.GetComponent <RootUnit>();
         if (target != null && (target.unitID != enemyAbilityStats.owner || (reflected && target.unitID == enemyAbilityStats.owner)) && target.isAlive)
         {
             DamageManager.CalculateEnemyAbilityDefender(collider.transform.GetComponent <RootUnit>().unitID, enemyAbilityStats.damage);
             Destroy(gameObject);
         }
     }
     else if (enemyAbilityStats.behavior == EnemyAbilityStats.Behavior.Area_Hit)
     {
     }
 }
Exemplo n.º 18
0
        public override void CreateVariables()
        {
            new SkinManager(11);

            damageManager = new DamageManager
                            (
                new List <Bases.Damage>()
            {
                new Bases.Damage
                (
                    Q, DamageType.Physical, new float[] { 0, 70, 110, 150, 190, 230 },

                    new List <Scale>()
                {
                    new Scale(new float[] { 0, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f }, ScalingTypes.AD),
                    new Scale(new float[] { 0, 1, 1, 1, 1, 1 }, ScalingTypes.AP)
                },
                    true, true
                ),

                new Bases.Damage
                (
                    W, DamageType.Magical, new float[] { 0, 40, 75, 110, 145, 180 },

                    new List <Scale>()
                {
                    new Scale(new float[] { 0, 0.6f, 0.6f, 0.6f, 0.6f, 0.6f }, ScalingTypes.AP)
                },
                    true, true
                ),

                new Bases.Damage
                (
                    E, DamageType.Physical, new float[] { 0, 50, 75, 100, 125, 150 },

                    new List <Scale>()
                {
                    new Scale(new float[] { 0, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f }, ScalingTypes.APBonus)
                }
                )
            }
                            );
        }
Exemplo n.º 19
0
    public void Do(IObject sender, SkillActionProperty sap)
    {
        if (Obj == null || sender == null || sap == null)
        {
            return;
        }

        if (mObj.mIsDead)
        {
            return;
        }

        // 判断技能是否击中(如霸体,魔免等技能都被未击中)
        SkillHitType sht = CheckSkillHit();

        if (sht != SkillHitType.SkillHitType_Hit)
        {
            // 如果没有击中,显示对应字样

            return;
        }

        // 播放受击效果
        InjuredAction(sender, sap);

        // 计算技能是否暴击
        if (!CheckCrit())
        {
            return;
        }

        // 计算技能伤害
        int damage = (int)DamageManager.GetDamageByAttack(sender, mObj);

        if (damage > 0)
        {
            LostHp(damage + Random.Range(-20, 0));
        }

        // 播放受击特效和音效
        EffectManager.Instance.SkillHitEffect(0, mObj.mGameObject);
        AudioManager.Instance.PlayBeSkilledAudio(0, mObj.mTransform);
    }
Exemplo n.º 20
0
    //This coroutine executes a player slide when contacting an enemy
    IEnumerator PlayerSlideRoutine()
    {
        //Determines the vector for the player to get knocked back
        var direction = (TestCharController.player.transform.position - transform.position).normalized;

        TestCharController.player.GetComponent <Rigidbody2D>().velocity = direction * 2;


        //Deal the monster's contact damage to the player
        DamageManager.PlayerDamage(25, TestCharController.player.gameObject, false);

        //Play the player's getting hurt SFX
        if (!TestCharController.breakInvuln)
        {
            TestCharController.playerAttack.clip = TestCharController.hurtNoise[Random.Range(0, TestCharController.hurtNoise.Length)];
            TestCharController.playerAttack.Play();
        }
        yield return(null);
    }
Exemplo n.º 21
0
    public void TakeDamage(int damage)
    {
        if (_isDead)
        {
            return;
        }

        if (DataManager.TakeDamage(damage))
        {
            _isDead = true;

            _rb2d.velocity = Vector2.zero;
            _upperBodyController.Died();
            _lowerBodyController.Died();
            _lowerBodyController.SetMoving(false);
            JamSceneManager.LoadSceneWithDelay(JamScene.MainMenu, 1.0F);
        }

        DamageManager.DisplayDamageAt(damage, transform.position + _damageOffset);
    }
Exemplo n.º 22
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Wall")
     {
         Destroy(gameObject);
     }
     else if (other.gameObject.tag == "Comp_Shield")
     {
         Destroy(gameObject);
         Companion_Controller.shieldAmount -= 10;
     }
     else if (other.gameObject.tag == "Player" && !TestCharController.invuln)
     {
         DamageManager.PlayerDamage(10, TestCharController.player.gameObject, false);
         //Play the player's getting hurt SFX
         TestCharController.playerAttack.clip = TestCharController.hurtNoise[Random.Range(0, TestCharController.hurtNoise.Length)];
         TestCharController.playerAttack.Play();
         Destroy(gameObject);
     }
 }
    void shootRay()
    {
        Vector3 direction = this.transform.forward;

        if (rigidBody)
        {
            direction = rigidBody.velocity.normalized;
        }
        RaycastHit hit;

        if (Physics.Raycast(this.transform.position, direction, out hit, 1000))
        {
            if (hit.collider)
            {
                DamageManager damage = hit.collider.GetComponent <DamageManager> ();
                if (damage)
                {
                    damage.ApplyDamage(10, rigidBody.velocity, null, Vector3.Distance(positionTmp, hit.point));
                }
                Destroy(this.gameObject);
                if (hit.collider.CompareTag("Player"))
                {
                    if (BodyHitFX)
                    {
                        GameObject fx = (GameObject)GameObject.Instantiate(BodyHitFX, hit.point, Quaternion.identity);
                        fx.transform.forward = hit.normal;
                        GameObject.Destroy(fx, 2);
                    }
                }
                else
                {
                    if (GroundHitFX)
                    {
                        GameObject fx = (GameObject)GameObject.Instantiate(GroundHitFX, hit.point, Quaternion.identity);
                        fx.transform.forward = hit.normal;
                        GameObject.Destroy(fx, 2);
                    }
                }
            }
        }
    }
Exemplo n.º 24
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Wall" && !isTriggered)
     {
         isTriggered = true;
         Instantiate(Resources.Load("Prefabs/SpellFX/Earth_Explode"), new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
         Instantiate(Resources.Load("Prefabs/Enemies/Pebble"), new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
         LevelCreator.levelGrid[LevelCreator.playerCurrentX, LevelCreator.playerCurrentY].enemyCount += 1;
         Destroy(gameObject);
     }
     else if (collider.tag == "Player" && !isTriggered)
     {
         isTriggered = true;
         DamageManager.PlayerDamage(30, TestCharController.player.gameObject, false);
         Instantiate(Resources.Load("Prefabs/SpellFX/Earth_Explode"), new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
         //Play the player's getting hurt SFX
         TestCharController.playerAttack.clip = TestCharController.hurtNoise[Random.Range(0, TestCharController.hurtNoise.Length)];
         TestCharController.playerAttack.Play();
         Destroy(gameObject);
     }
 }
Exemplo n.º 25
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Obstacle" || collision.gameObject.tag == "Nave")
     {
         DamageManager dm          = collision.contacts[0].thisCollider.gameObject.GetComponentInParent <DamageManager>();
         float         impactForce = Vector3.Dot(collision.contacts[0].normal, collision.relativeVelocity);
         impactForce = Mathf.Clamp(impactForce, 0, float.MaxValue);
         if (collision.contacts[0].thisCollider.gameObject.GetComponentInParent <DamageManager>())
         {
             collision.contacts[0].thisCollider.gameObject.GetComponentInParent <DamageManager>().TakeDamage(impactForce * GetComponent <Stats>().currentCollisionDamage *(1 / collisionDamageReduction), false);
         }
         if (collision.gameObject.GetComponent <DamageManager>())
         {
             collision.gameObject.GetComponent <DamageManager>().TakeDamage(impactForce * collision.contacts[0].thisCollider.gameObject.GetComponentInParent <Stats>().currentCollisionDamage *(1 / collisionDamageReduction), false);
         }
         else if (collision.gameObject.GetComponentInParent <DamageManager>())
         {
             collision.gameObject.GetComponentInParent <DamageManager>().TakeDamage(impactForce * collision.contacts[0].thisCollider.gameObject.GetComponentInParent <Stats>().currentCollisionDamage *(1 / collisionDamageReduction), false);
         }
     }
 }
Exemplo n.º 26
0
    public void TakeDamage(int damage)
    {
        if (_isDead)
        {
            return;
        }

        DamageManager.DisplayDamageAt(damage, transform.position + _damageOffset);

        _health -= damage;
        _healthFillBar.fillAmount = Mathf.Clamp01((float)_health / _initialHealth);
        if (_health <= 0)
        {
            _health = 0;
            _isDead = true;

            _rb2d.velocity = Vector2.zero;
            _animator.SetTrigger(DEATH_TRIGGER);
            StopAllCoroutines();
        }
    }
    private void Start()
    {
        _torsoMoveSpeed = 40;
        _headMoveSpeed  = 45;
        _legMoveSpeed   = 30;


        _moveBackwardDistance = 25;
        _rb          = this.GetComponent <Rigidbody>();
        _anim        = this.GetComponentInChildren <Animator>();
        _muzzleFlash = this.GetComponentInChildren <ParticleSystem>();

        playerObject1  = GameObject.FindGameObjectWithTag("Player");
        hero1          = playerObject1.GetComponent <PlayerController>();
        playerToFollow = playerObject1.transform.GetChild(1).transform;

        // muzzle flash color
        _mfMain            = _muzzleFlash.main;
        _mfMain.startColor = ColorDataBase.GetEnemyStripAlbedo();
        dm = playerObject1.GetComponent <DamageManager>();
    }
    GameObject findTarget()
    {
        GameObject gettarget = null;
        float      length    = float.MaxValue;

        for (int t = 0; t < TargetTag.Length; t++)
        {
            // Finding all the targets by Tags.
            TargetCollector targetget = UnitZ.aiManager.FindTargetTag(TargetTag[t]);
            if (targetget != null)
            {
                GameObject[] targets = targetget.Targets;
                if (targets != null && targets.Length > 0)
                {
                    for (int i = 0; i < targets.Length; i++)
                    {
                        if (targets[i] != null && targets[i].transform.root != this.transform.root)
                        {
                            DamageManager targetdamagemanager = targets[i].GetComponent <DamageManager>();
                            // if target has a damage manager and alive
                            if (targetdamagemanager != null && targetdamagemanager.IsAlive && targetdamagemanager.Team != character.Team || targetdamagemanager.Team == 0)
                            {
                                float distancetargets = Vector3.Distance(targets[i].gameObject.transform.position, this.gameObject.transform.position);
                                if ((distancetargets <= length && (distancetargets <= DistanceMoveTo || distancetargets <= currentDistanceWeapon)))
                                {
                                    // get a target only in distance or rush mode enabled
                                    if (canSeeTarget(Pointer.transform.position, targets[i].gameObject) || RushMode)
                                    {
                                        length    = distancetargets;
                                        gettarget = targets[i].gameObject;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return(gettarget);
    }
Exemplo n.º 29
0
    GameObject findTarget()
    {
        GameObject gettarget = null;
        float      length    = float.MaxValue;

        for (int t = 0; t < TargetTag.Length; t++)
        {
            //通过Tags找到所有目标
            TargetCollector targetget = UnitZ.aiManager.FindTargetTag(TargetTag[t]);
            if (targetget != null)
            {
                GameObject[] targets = targetget.Targets;
                if (targets != null && targets.Length > 0)
                {
                    for (int i = 0; i < targets.Length; i++)
                    {
                        if (targets[i] != null && targets[i].transform.root != this.transform.root)
                        {
                            DamageManager targetdamagemanager = targets[i].GetComponent <DamageManager>();
                            //如果目标存活,并且具有demagemanager
                            if (targetdamagemanager != null && targetdamagemanager.IsAlive)
                            {
                                float distancetargets = Vector3.Distance(targets[i].gameObject.transform.position, this.gameObject.transform.position);
                                if ((distancetargets <= length && (distancetargets <= DistanceMoveTo || distancetargets <= currentDistanceWeapon)))
                                {
                                    //远距离发现目标
                                    if (canSeeTarget(Pointer.transform.position, targets[i].gameObject) || RushMode)
                                    {
                                        length    = distancetargets;
                                        gettarget = targets[i].gameObject;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return(gettarget);
    }
Exemplo n.º 30
0
    /// <summary>
    /// 受击触发的类型;
    /// 受击技能的Id;
    /// 受击的帧数;
    /// </summary>
    public void InjuredSkillType(IObject attacker, SkillActionProperty skillActionProperty)
    {
        if (mObj.mIsDead)
        {
            return;
        }

        MoveSkillInjured(0, null);

        HeightSkillInjured(0, null, null);

        //计算掉血
        int damage = (int)DamageManager.GetDamageByAttack(attacker, mObj);

        if (damage > 0)
        {
            LostHp(damage + Random.Range(-20, 0));
        }

        int injuredAudio = attacker.GetProperty("HurtAudio").GetInt();

        if (injuredAudio > 0)
        {
            AudioManager.Instance.PlayBattleEffectAudio(injuredAudio, mObj);
        }

        if (mObj is CRoleObject)
        {
            if (attacker.mObjId == 120009 || attacker.mObjId == 120010 || attacker.mObjId == 120011)
            {
            }
            else
            {
                return;
            }
        }

        InjuredAction(attacker, skillActionProperty);
    }
Exemplo n.º 31
0
    public void ResolveValueStatuses()
    {
        float totalStatusChange = 0;

        for (int i = activeStatuses.Count - 1; i > -1; i--)
        {
            totalStatusChange -= activeStatuses[i].rate * Time.deltaTime;
            activeStatuses[i].currentDuration += Time.deltaTime;
            if (activeStatuses[i].currentDuration > activeStatuses[i].maxDuration)
            {
                foreach (ModifierGroup modifierGroup in activeStatuses[i].modifierGroups)
                {
                    totalStats.DecreaseStat(modifierGroup.Stat, modifierGroup.Aspect, modifierGroup.Method, modifierGroup.Value);
                }
                activeStatuses.RemoveAt(i);
            }
        }
        if (totalStatusChange != 0)
        {
            DamageManager.CalculateStatusDamage(this, totalStatusChange);
        }
    }
Exemplo n.º 32
0
        public static void JungleClearmode()
        {
            foreach (Obj_AI_Base minion in EntityManager.MinionsAndMonsters.GetJungleMonsters(Variables._Player.ServerPosition, Program.Q.Range, true))
            {
                if (minion == null)
                {
                    return;
                }

                if (MenuManager.JungleClearMenu["Q"].Cast <CheckBox>().CurrentValue&& Program.Q.IsReady() && minion.IsValidTarget())
                {
                    if (minion.Health <= DamageManager.QDamage(minion))
                    {
                        Program.Q.Cast(minion.ServerPosition);
                        Core.DelayAction(Orbwalker.ResetAutoAttack, 250);
                    }
                    else if (Program.Q.IsReady())
                    {
                        Program.Q.Cast(minion.ServerPosition);
                        Core.DelayAction(Orbwalker.ResetAutoAttack, 250);
                    }
                }
                if (MenuManager.JungleClearMenu["E"].Cast <CheckBox>().CurrentValue&& Program.E.IsReady() && minion.IsValidTarget(Program.E.Range) && Variables.CanCastE(minion))
                {
                    if (minion.Health <= DamageManager.EDamage(minion))
                    {
                        Program.E.Cast(minion);
                    }
                    else
                    {
                        Program.E.Cast(minion);
                    }
                }
                if (MenuManager.JungleClearMenu["Items"].Cast <CheckBox>().CurrentValue)
                {
                    Items.UseItems(minion);
                }
            }
        }
Exemplo n.º 33
0
    IEnumerator DamageRoutine()
    {
        yield return(new WaitForEndOfFrame());

        endPoint = new Vector2(TestCharController.player.transform.position.x,
                               TestCharController.player.transform.position.y - .25f);
        startPoint = transform.position;


        for (int i = 0; i < 100; i++)
        {
            //Translate to the player
            transform.Translate((endPoint - startPoint) / 100);
            yield return(new WaitForSeconds(.01f));
        }



        //Move towards the end point
        yield return(new WaitForSeconds(3f));

        Instantiate(Resources.Load <GameObject>("Prefabs/Enemies/EnemyAttack/Chomper_Spike"),
                    new Vector2(transform.position.x, transform.position.y + .15f), Quaternion.identity);

        for (int i = 0; i < victims.Count; i++)
        {
            if (victims[i].tag == "Player")
            {
                DamageManager.PlayerDamage(20, victims[i], false);
            }
            else
            {
                victims[i].GetComponent <Companion_Controller>().DamageCompanion(20);
            }
        }


        Destroy(gameObject);
    }
Exemplo n.º 34
0
    // Use this for initialization
    void OnEnable()
    {
        gridAttachedPieces = new GameObject[4];
        PointerHolder p = MissionManager.instance.pointers;

        gridAttachedPieces[0] = p.combatant1.healthBar.gameObject;
        gridAttachedPieces[1] = p.combatant2.healthBar.gameObject;
        gridAttachedPieces[2] = p.combatant2.multiplierText.gameObject;
        gridAttachedPieces[3] = p.player2Grid.transform.Find("NextPieceText").gameObject;
        darkness         = p.daaaaaknesssss;
        gridToSetup      = p.player1Grid;
        gridToTurnIntoAI = p.player2Grid;
        pawnToHide       = p.ship2.stuffToHideIfThisPawnIsDisabledByTheMission;
        cameraToMove     = p.cameraWrapper2.gameObject;
        shipWrapper.GetComponent <DestroySpaceshipOnDeath>().stuffToHide.Add(p.combatant2.multiplierText.GetComponent <SpriteRenderer>());
        shipWrapper.GetComponent <DestroySpaceshipOnDeath>().stuffToHide.Add(gridAttachedPieces[3].GetComponent <SpriteRenderer>());
        damageManager = p.combatant2.damageManager;
        p.restartButton1.gameObject.SetActive(true);
        p.restartButton2.gameObject.SetActive(true);

        narrations[0].gameObject.SetActive(true);
        MissionManager.isInCutscene = true;
    }
Exemplo n.º 35
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.gameObject.tag == "Enemy_Proj")
     {
         Destroy(collider.gameObject);
         projHit++;
         color -= .25f;
         GetComponent <SpriteRenderer>().color = new Color(color, color, color);
         if (projHit == 3)
         {
             Instantiate(Resources.Load("Prefabs/SpellFX/Earth_Explode"), new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
             gameObject.SetActive(false);
         }
     }
     else if (collider.gameObject.tag == "Enemy" && !triggered)
     {
         triggered = true;
         int tempInt = DamageManager.MagicDamage(collider.gameObject, 10);
         collider.gameObject.GetComponent <Monster>().DamageMonster(tempInt);
         Instantiate(Resources.Load("Prefabs/SpellFX/Earth_Explode"), new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
         gameObject.SetActive(false);
     }
 }
Exemplo n.º 36
0
 void Start()
 {
     if(damageManage == null){
         damageManage = this.RootObject.GetComponent<DamageManager> ();
     }
 }
Exemplo n.º 37
0
	void Start () 
	{
		DamageManage = this.gameObject.GetComponent<DamageManager>();
		WeaponControl = this.gameObject.GetComponent<WeaponController>();
	}
Exemplo n.º 38
0
    // Use this for initialization
    IEnumerator Start()
    {
        aiShip = transform.GetComponentInChildren<AIShipController>();
        //Debug.Log (aiShip.ToString());
        dm = transform.GetComponentInChildren<DamageManager>();
        //Debug.Log (dm.ToString());
        playerShip = GameObject.FindWithTag("Player");
        //Debug.Log (playerShip.GetFullName());
        demoTree = BLAIDemo.InstantiateTree(
            BLAIDemo.TreeType.AIDemo_DemoTree, this);

        while(Application.isPlaying && demoTree != null)
        {
            Debug.Log (this.transform.name + " updating AI state");
            yield return new WaitForSeconds(1.0f / demoTree.Frequency);
            AIUpdate();
        }
    }