예제 #1
0
    private void Initialize()
    {
        AttackManager attackManager = AttackManager.INSTANCE;

        if (!attackManager)
        {
            return;
        }
        attacks = new Attack[attackDatas.Length];

        for (int i = 0; i < attackDatas.Length; i++)
        {
            Attack attack = attackManager.GetAttack(attackDatas[i].attackType);

            if (!attack)
            {
                continue;
            }
            attacks[i] = Instantiate(attack, transform);
            attacks[i].Initialize(attackDatas[i].GetInstance());
            attacks[i].weaponTransform = attackerData.weaponTransform;
            attacks[i].weapon          = attackerData.weapon;
            attacks[i].attacker        = this;
        }
    }
예제 #2
0
    public override void AttackEvent()
    {
        int bonuses = 0;

        if (NextToEnemy)
        {
            bonuses = -1;
        }
        Result     hit     = AttackManager.AttackRoll(owner, currentTarget.unitTargeted.GetComponent <Unit>(), bonuses);
        GameObject missile = Instantiate(GameAssets.i.ArrowModel, owner.offHandSlot.position, owner.transform.rotation) as GameObject;

        missile.GetComponent <Missile>().target = currentTarget.unitTargeted.transform.position + new Vector3(0, currentTarget.unitTargeted.GetComponent <TacticsMovement>().halfHeight);

        //Debug.
        //GameObject marker = Instantiate(GameAssets.i.TargetMarker, currentTarget.unitTargeted.transform.position + new Vector3(0, currentTarget.unitTargeted.GetComponent<TacticsMovement>().halfHeight), Quaternion.identity);

        missile.GetComponent <Missile>().Launch(hit);
        missile.GetComponent <Missile>().targetUnit   = currentTarget.unitTargeted;
        missile.GetComponent <Missile>().firingWeapon = this;

        if (hit == Result.FAIL)
        {
            gameObject.GetComponent <UnitPopUpManager>().AddPopUpInfo("miss");
        }

        owner.aimingBow = false;
        NextToEnemy     = false;
        owner.FaceDirection(currentTarget.unitTargeted.gameObject.transform.position);
        rangedWeaponData.currentAmmo--;
    }
예제 #3
0
 void Update()
 {
     //boss 当前为攻击状态
     if (boss_attackstate)
     {
         timer -= Time.deltaTime;
         //检测寻路
         if (CheckNavDistance(3f))
         {
             bossnav.GetComponent <NavMeshAgent>().enabled = false;
             if (timer <= 0)
             {
                 timer = TIME;
                 AttackManager.GetInstance().BossAttack(transform.gameObject, ConstantData.GetInstance().Player);
             }
         }
         else if (CheckNavDistance(6f))
         {
             bossnav.GetComponent <NavMeshAgent>().enabled = true;
             bossnav.destination = ConstantData.GetInstance().Player.transform.position;
             transform.GetComponent <BossAnimCon>().Run();
         }
         //检测跟随攻击距离
         CheckAttackDistance(6f);
     }
 }
        public void TestDecision1v1_South()
        {
            GameState state = new GameState(10, 10, 1, 1, 1, 5, 1);

            state.Set(new Tile[, ]
            {
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, a, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, A, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
            });

            AttackManager dut = new AttackManager(state);

            dut.MoveOffensive(state);

            Assert.IsTrue(state.MyAnts[0].hasMoved);
            Assert.AreEqual(Direction.North, state.MyAnts[0].direction);
        }
    public void AssignInheritedReferences()
    {
        _AttackManager = GetComponent <AttackManager>();
        _HealthManager = GetComponent <HealthManager>();

        // These don't have any public variables, so adding them at the runtime makes the prefab less cluttered
        _DamageManager   = gameObject.AddComponent <DamageManager>();
        _CollisionKeeper = gameObject.AddComponent <CollisionKeeper>();

        _Rigidbody2D = GetComponent <Rigidbody2D>();
        _Collider2D  = GetComponent <CapsuleCollider2D>();

        _SpriteRenderer = GetComponent <SpriteRenderer>();
        _Sprite         = _SpriteRenderer.sprite;

        var surrogatePrefab = (GameObject)Resources.Load("Prefabs/Surrogate");
        var surrogate       = Instantiate(surrogatePrefab);

        surrogate.layer = gameObject.layer;
        surrogate.name  = $"{gameObject.name} Surrogate";
        surrogate.transform.position = gameObject.transform.position;
        _Surrogate = surrogate.GetComponent <Surrogate>();
        _Surrogate.SetOwner(gameObject);

        foreach (var weapon in HeldWeapons)
        {
            weapon.WeaponObject       = Instantiate(weapon.WeaponPrefab, _Surrogate.gameObject.transform);
            weapon.WeaponObject.layer = gameObject.layer;
            weapon._Weapon            = weapon.WeaponObject.GetComponent <Weapon>();
            weapon._Weapon.Owner      = gameObject;
        }
    }
예제 #6
0
        /// <summary>
        /// On essaye d'auto attack une cible, Si elle est a portée on lance l'animation
        /// Sinon, on marche jusqu'a elle
        /// </summary>
        /// <param name="targetUnit"></param>
        public void TryBasicAttack(AttackableUnit targetUnit)
        {
            if (!targetUnit.Alive)
            {
                return;
            }
            if (this.GetDistanceTo(targetUnit) <= GetAutoattackRange(targetUnit))
            {
                if (IsMoving) // Si on est en mouvement, on s'arrête
                {
                    StopMove();
                }
                AttackManager.BeginAttackTarget(targetUnit); // on lance la première auto
            }
            else
            {
                if (Stats.MoveSpeed.TotalSafe > 0)
                {
                    AttackManager.StopAttackTarget();                                         // on arrête d'attaquer l'éventuelle cible, car on va se déplacer.

                    if (AttackManager.IsAttacking && !AttackManager.CurrentAutoattack.Casted) // Si on a cancel l'auto avant que les dégats soit infligés, alors on peut la disposer.
                    {
                        AttackManager.DestroyAutoattack();
                    }

                    Action onTargetReach = new Action(() => { TryBasicAttack(targetUnit); }); // recursive call
                    PathManager.MoveToTarget(targetUnit, onTargetReach, GetAutoattackRangeWhileChasing(targetUnit));
                    OnMove();
                }
            }
        }
예제 #7
0
 void Start()
 {
     isDead        = false;
     animator      = GetComponent <Animator>();
     attackManager = AttackManager.Instance;
     attackManager.Subscribe(this);
 }
예제 #8
0
        public void ExpectedHitsTest()
        {
            // Setup
            Monster actor = new Monster
            {
                Hits     = 1,
                Accuracy = 99
            };

            Monster target = new Monster();

            // Test expected hit messages and miss threshold
            int missThreshold = 20; // 2% (1% expected)

            for (int i = 0; i < 1000; i++)
            {
                AttackResult res = AttackManager.AttackMonster(actor, target);
                if (String.Equals(res.DamageMessage, "Miss"))
                {
                    missThreshold--;
                }
                else
                {
                    Assert.IsTrue(String.Equals(res.HitsMessage, "1xHit"));
                }
            }

            // Ensure some misses happened, but not too many
            Assert.AreNotEqual(20, missThreshold);
            Assert.IsTrue(missThreshold > 0);
        }
예제 #9
0
 private void Awake()
 {
     spriteRenderer = GetComponent <SpriteRenderer>();
     animator       = GetComponent <Animator>();
     attackManager  = GetComponent <AttackManager>();
     playerInput    = GetComponent <PlayerInput>();
 }
예제 #10
0
파일: Attack.cs 프로젝트: allandeee/SFG
 // Use this for initialization
 void Start()
 {
     if (myAttackManager == null)
     {
         myAttackManager = transform.root.GetComponent <AttackManager>();
     }
 }
 void Start()
 {
     anim      = GetComponent <Animator>();
     sRenderer = GetComponent <SpriteRenderer>();
     source    = GetComponent <AudioSource>();
     attackMan = GetComponent <AttackManager>();
 }
예제 #12
0
    private void Awake()
    {
        if (!Instance)
        {
            Instance = this;
            // DontDestroyOnLoad (this);
        }
        else
        {
            Destroy(this);
        }

        mainCamera      = Camera.main;
        Raycaster       = mainCamera.GetComponent <Physics2DRaycaster> ();
        spells          = FindObjectOfType <Spells> ();
        field           = FindObjectOfType <Field> ();
        buildingManager = FindObjectOfType <BuildingManager> ();
        attackManager   = FindObjectOfType <AttackManager> ();
        castManager     = FindObjectOfType <CastManager> ();
        enemyController = FindObjectOfType <EnemyController> ();
        touchController = FindObjectOfType <TouchController>();
        wizard          = FindObjectOfType <Wizard> ();
        xpPoints        = wizard.GetComponent <XPpoints> ();
        GameController  = FindObjectOfType <GameController> ();
        uIManager       = FindObjectOfType <UIManager> ();
        firePoints      = FindObjectOfType <FirePoints> ();
    }
예제 #13
0
    public FireworkAttackStrategy(WeaponBase weaponBase) : base(1)
    {
        if (FW_DestroyEffectPool == null)
        {
            FW_DestroyEffect                    = (weaponBase.WeaponComponent() as Firework).FW_DestroyEffect;
            FW_DestroyEffectPool                = EffectManager.GetInstance().effectParent.gameObject.AddComponent <Pool>();
            FW_DestroyEffectPool.poolPrefab     = FW_DestroyEffect;
            FW_DestroyEffectPool.initialCount   = FW_DestroyEffectinitialCount;
            FW_DestroyEffectPool.incrementCount = FW_DestroyEffectincrementCount;
            FW_DestroyEffectPool.Initialize();
        }
        if (bulletPool == null)
        {
            bulletPrefab = (weaponBase.WeaponComponent() as Firework).BulletPrefab;
            bulletPrefab.DestroyEffectPool = FW_DestroyEffectPool;
            bulletPrefab.effectParent      = EffectManager.GetInstance().effectParent.transform;
            bulletPool = AttackManager.GetInstance().bulletParent.gameObject.AddComponent <Pool>();
            bulletPool.incrementCount = FW_bulletincrementCount;
            bulletPool.initialCount   = FW_bulletinitialCount;
            bulletPool.poolPrefab     = bulletPrefab.gameObject;
            bulletPool.Initialize();
        }


        dashCondition = true;
        m             = new AttackMessage();
        weapon        = weaponBase;

        fireworkMuzzleTransform = weaponBase.transform.Find("FireWorkParent/Firework/FireworkMuzzle/FireworkMuzzlePosition");

        attackMoveCondition = MoveWhileAttack.Move_Attack;
    }
예제 #14
0
 protected override void InitializeInternal(SkillService skillService, IBattleUnit attacker)
 {
     _attackManager = new AttackManager(attacker)
     {
         AttackerDamageFactory = a => Convert.ToInt64(a.GetDamage() * DamageKoef) + BonusDamage
     };
 }
        public override AttackManager Attack(float damageMultiplier, List <IAttacker> owners)
        {
            if (GetAttack == null)
            {
                return(null);
            }

            AttackManager attack = base.Attack(damageMultiplier, owners);

            if (attack == null)
            {
                return(null);
            }

            IAmmo ammo = (IAmmo)attack;

            ammo.SetInitialWeaponDirection(DirectionalObject.Direction);
            ammo.SetIntialVelocity(FireVelocity);
            ammo.SetInitialWeaponPosition(WeaponPosition);
            owners.ForEach(t => t.ReceiveStoppingPower(stoppingPower));

            Instantiate(muzzleFlashEffect, WeaponPosition, transform.rotation, null);

            return(ammo.GetAttackManager);
        }
예제 #16
0
 public void onWeaponTouch(int colliderType, IHitable target)
 {
     //!TODO fsm만이 아니라 그냥 오브젝트들도 다 되게 할 것
     if (attackedColliders.Contains(target))
     {
         return;
     }
     attackedColliders.Add(target);
     if (colliderType == 0)
     {
         m.effectType = EffectType.MID;
         if (tempAtkCount == 1)
         {
             AttackManager.GetInstance().HandleAttack(AttackHandle, target, player, Damages[tempAtkCount] * 4, false, true);
         }
         else
         {
             AttackManager.GetInstance().HandleAttack(AttackHandle, target, player, Damages[tempAtkCount] * 4);
         }
     }
     else
     {
         m.effectType = EffectType.SMALL;
         AttackManager.GetInstance().HandleAttack(AttackHandle, target, player, Damages[tempAtkCount]);
     }
 }
예제 #17
0
 public void CheckAttack()
 {
     Collider[] colliders = Physics.OverlapSphere(transform.position, 2.5f, LayerMask.GetMask("Boss"));
     Debug.Log("Len" + colliders.Length);
     if (colliders.Length > 0)
     {
         for (int i = 0; i < colliders.Length; i++)
         {
             GameObject bosstemp = colliders[i].gameObject;
             //ConstantData.GetInstance().currBoss = bosstemp;
             //触发主角攻击
             // AttackManager.GetInstance().PlayerAttack(transform.gameObject, bosstemp);
             //触发 boss 自动攻击
             bosstemp.GetComponent <BossBase>().SetBossAttackState(true);
             //AttackManager.GetInstance().BossAutoAttack(bosstemp, transform.gameObject,2.0f);
         }
         GameObject currboss = colliders[0].gameObject;
         ConstantData.GetInstance().currBoss = currboss;
         //触发主角攻击
         AttackManager.GetInstance().PlayerAttack(transform.gameObject, currboss);
         //触发 boss 自动攻击
         currboss.GetComponent <BossBase>().SetBossAttackState(true);
         //AttackManager.GetInstance().BossAutoAttack(bosstemp, transform.gameObject,2.0f);
         Debug.Log("Attack the boss");
     }
 }
예제 #18
0
 void Awake()
 {
     Instance           = this;
     m_AttackRangeTiles = new HashSet <Tile> ();
     m_TargetsInRange   = new List <SpaceObject>();
     m_TargetNumber     = 0;
 }
예제 #19
0
 // Use this for initialization
 void Start()
 {
     bodyController = GetComponent <BodyController>();
     initAgent();
     attackManager = GetComponent <AttackManager>();
     //Destroy(this.GetComponent<CharacterController>());
 }
예제 #20
0
    /*
     * Read in a CSV Attack file generated from our Google Spreadsheet of attacks. Each
     * line will be an Attack, stored as a comma delimited value for each field in our Attack class.
     * Once complete, write the name of each attack in a lookup file of strings.
     */
    void ImportAttacks()
    {
        attackManager = (AttackManager)GameObject.Find(ObjectNames.MAANAGERS).GetComponent <AttackManager> ();
        if (attackManager == null)
        {
            Debug.LogError("Attack Manager could not be found");
            return;
        }
        TextAsset attackCsv = (TextAsset)Resources.Load(ATTACK_CSV, typeof(TextAsset));

        if (attackCsv == null)
        {
            Debug.LogError(string.Format("Attack file {0} failed to load correctly.", ATTACK_CSV));
            return;
        }
        attackManager.ClearAttacks();
        string[] lineArray = attackCsv.text.Split("\n" [0]);
        VerifyHeaderLine(lineArray [0]);
        for (int i = 1; i < lineArray.Length; i++)
        {
            Attack newAttack = SerializeAttackLine(lineArray [i]);
            attackManager.AddAttack(newAttack);
        }
        WriteAttacksToStringFile();
    }
예제 #21
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #22
0
        public bool Move(List <Vector2> waypoints, bool unsetTarget = true, bool notify = true)
        {
            if (DashManager.IsDashing)
            {
                return(false);
            }
            if (SpellManager.IsChanneling())
            {
                return(false);
            }
            if (Stats.MoveSpeed.TotalSafe > 0)
            {
                if (unsetTarget)
                {
                    AttackManager.StopAttackTarget();

                    if (AttackManager.IsAttacking && !AttackManager.CurrentAutoattack.Casted)
                    {
                        AttackManager.DestroyAutoattack();
                    }
                }

                EventsBinder.OnStartMoving(waypoints.ToArray());

                PathManager.Move(waypoints);

                if (notify)
                {
                    NotifyWaypoints();
                }

                return(true);
            }
            return(false);
        }
예제 #23
0
 // Use this for initialization
 void Start()
 {
     health = GetComponent <Health>();
     health.OnDeathChange += Die;
     attackManager         = new AttackManager(this.gameObject, buildingData.attackData);
     workers = 0;
 }
예제 #24
0
        public void Move(List <Vector2> waypoints, bool unsetTarget = true, bool notify = true)
        {
            if (SpellManager.IsChanneling())
            {
                return;
            }
            if (Stats.MoveSpeed.TotalSafe > 0)
            {
                if (unsetTarget)
                {
                    AttackManager.StopAttackTarget();

                    if (AttackManager.IsAttacking && !AttackManager.CurrentAutoattack.Casted)
                    {
                        AttackManager.DestroyAutoattack();
                    }
                }

                PathManager.Move(waypoints);

                if (notify)
                {
                    OnMove();
                }
            }
        }
예제 #25
0
        public void TestNoWater_2()
        {
            GameState state = new GameState(10, 10, 1, 1, 1, 5, 1);

            state.Set(new Tile[, ]
            {
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, w, w, _, _, _, _, _ },
                { _, _, _, a, w, _, A, _, _, _ },
                { _, _, _, w, w, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
            });

            AttackManager dut = new AttackManager(state);

            dut.MoveOffensive(state);

            Assert.IsTrue(state.MyAnts[0].hasMoved);
            Assert.AreEqual(Direction.West, state.MyAnts[0].direction);
        }
    public virtual void Init(bool isPlayerOne, GameObject otherFighter)
    {
        GameObject canvas = GameObject.FindGameObjectWithTag("Canvas");

        gameManager            = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <GameManager>();
        rb                     = GetComponent <Rigidbody>();
        this.isPlayerOne       = isPlayerOne;
        this.otherFighter      = otherFighter;
        otherFighterController = otherFighter.GetComponent <FighterController>();
        fighterControllerState = FighterControllerState.DetermineFighterControllerState(this);

        if (isPlayerOne)
        {
            controllerInput = ControllerManager.GetControllerInput(1);
            fighterUI       = canvas.transform.GetChild(0).GetComponent <FighterUI>();
        }
        else
        {
            controllerInput = ControllerManager.GetControllerInput(2);
            fighterUI       = canvas.transform.GetChild(1).GetComponent <FighterUI>();
        }
        anim          = GetComponent <Animator>();
        attackManager = GetComponent <AttackManager>();
        attackManager.Init();
        fighterUI.Init();

        startingPosition.Set(transform.position.x, transform.position.y, transform.position.z);
        startingRotation.Set(transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w);
        startingScale.Set(transform.localScale.x, transform.localScale.y, transform.localScale.z);
    }
예제 #27
0
    public virtual bool ReceiveAttack(AttackManager atkMngr)
    {
        if (atkMngr == null)
        {
            return(false);
        }
        OwnerComponent   ownerComponent = atkMngr.GetAttackComponent <OwnerComponent>();
        List <IAttacker> owners         = ownerComponent.owners;
        IAttacker        thisAttacker   = (this as IAttacker);
        Entity           destroyer      = null;

        foreach (IAttacker owner in owners)
        {
            if (owner is Entity e)
            {
                destroyer = e;
                break;
            }
        }
        if (thisAttacker != null && owners.Contains(thisAttacker))
        {
            return(false);
        }
        DamageComponent damageComponent = atkMngr.GetAttackComponent <DamageComponent>();

        if (damageComponent != null)
        {
            float damage = damageComponent.DamageIncludingBonuses;
            TakeDamage(damage, atkMngr.Position, destroyer, 1f, true);
        }

        return(true);
    }
예제 #28
0
    /// <summary>
    /// 提高伤害值
    /// </summary>
    private IEnumerator AttackUpForSceconds(AttackManager targetAttack, float amount)
    {
        targetAttack.additionDamage += amount;
        yield return(new WaitForSeconds(duaration));

        targetAttack.additionDamage -= amount;
    }
예제 #29
0
파일: EnemyMap.cs 프로젝트: artboy77/Golem
 void AddEnemyIndicator(AttackManager attackManager)
 {
     GameObject _enemyIndicatorObj = Instantiate (enemyIndicatorObj, transform.position, Quaternion.identity) as GameObject;
     _enemyIndicatorObj.transform.parent = transform;
     EnemyIndicator enemyIndicator = _enemyIndicatorObj.GetComponent<EnemyIndicator> ();
     enemyIndicator.attackManager = attackManager;
 }
예제 #30
0
 void Start()
 {
     rb          = GetComponent <Rigidbody2D>();
     playerState = GetComponent <PlayerState>();
     movement    = GetComponent <PlayerMovement>();
     attacking   = GetComponent <AttackManager>();
 }
예제 #31
0
        public void TestDisengage()
        {
            GameState state = new GameState(10, 10, 1, 1, 1, 5, 1);

            state.Set(new Tile[, ]
            {
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, A, A, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
                { _, _, _, _, _, a, _, _, _, _ },
                { _, _, _, _, a, _, _, _, _, _ },
                { _, _, _, _, _, _, _, _, _, _ },
            });

            AttackManager dut = new AttackManager(state);

            dut.MoveOffensive(state);

            Assert.IsTrue(state.MyAnts[0].hasMoved);
            Assert.IsFalse(state.MyAnts[1].hasMoved);
        }
예제 #32
0
    public void SelectCharacter(AttackManager attackManager)
    {
        myManager = attackManager;
        mySO = new SerializedObject(attackManager);
        title = myManager.name + " Attacks";

        Repaint();
    }
예제 #33
0
	void Awake ()
	{
		detectCol = GetComponentInChildren<Collider>();
		detectionMethod = GetComponent<DetectionMethod>();
		attackManager = GetComponent<AttackManager>();
		//deathSequence = GetComponent<DeathSequence>();
		//healthManager = GetComponent<HealthManager>();

	}
예제 #34
0
파일: Attack.cs 프로젝트: artboy77/Golem
 protected void InitAttackVariables()
 {
     attackManager = GetComponent<AttackManager> ();
     flyingEnemyNavigation = GetComponent<FlyingEnemyNavigation> ();
     groundEnemyNavigation = GetComponent<GroundEnemyNavigation> ();
     navMeshAgent = GetComponent<NavMeshAgent> ();
     collisionDetection = GetComponent<CollisionDetection> ();
     target = Player.instance.positionController.transform;
 }
예제 #35
0
파일: Enemy.cs 프로젝트: syeager/Knighthood
    protected override void Awake()
    {
        base.Awake();

        // get references
        myNavAgent = GetComponent<NavAgent>();
        attackManager = GetComponent<AttackManager>();
        attackManager.Initialize(this);

        // set up
        myHealth.Initialize();
    }
예제 #36
0
	// Use this for initialization
	void Start () {
		//Set up references to other components
		stats = GetComponent<CharacterStats>();
		anim = GetComponent<Animator>();
		//controller = GetComponent<CharacterController>();
		collider = GetComponent<CapsuleCollider>();
		manager = GetComponentInChildren<AttackManager>();
		manager.enemy = false;
		gravity = stats.gravity;




	}
예제 #37
0
 /*
  * Read in a CSV Attack file generated from our Google Spreadsheet of attacks. Each
  * line will be an Attack, stored as a comma delimited value for each field in our Attack class.
  * Once complete, write the name of each attack in a lookup file of strings.
  */
 void ImportAttacks()
 {
     attackManager = (AttackManager)GameObject.Find (ObjectNames.MAANAGERS).GetComponent <AttackManager> ();
     if (attackManager == null) {
         Debug.LogError ("Attack Manager could not be found");
         return;
     }
     TextAsset attackCsv = (TextAsset)Resources.Load (ATTACK_CSV, typeof(TextAsset));
     if (attackCsv == null) {
         Debug.LogError (string.Format ("Attack file {0} failed to load correctly.", ATTACK_CSV));
         return;
     }
     attackManager.ClearAttacks ();
     string[] lineArray = attackCsv.text.Split ("\n" [0]);
     VerifyHeaderLine (lineArray [0]);
     for (int i = 1; i < lineArray.Length; i++) {
         Attack newAttack = SerializeAttackLine (lineArray [i]);
         attackManager.AddAttack (newAttack);
     }
     WriteAttacksToStringFile ();
 }
예제 #38
0
    void OnEnable()
    {
        NavMeshHit hit = new NavMeshHit();
        if (NavMesh.SamplePosition(transform.position, out hit, 100, 1)) {
            transform.position = hit.position;
            navMeshAgent = GetComponent<NavMeshAgent> ();
            navMeshAgent.enabled = true;
        } else {
            Debug.Log("shit");
        }

        flying = false;
        EnemyManager.instance.OnBuff += Buff;
        target = Player.instance.positionController.transform;

        attackManager = GetComponent<AttackManager> ();
        attackManager.collisionDetection.OnDeath += RemoveEvents;
        AreaEnemySpawner.instance.OnStateChange += RemoveEvents;
        EnemyManager.instance.NotifyNewEnemy (attackManager);
        Buff ();
        state = Roaming;
    }
예제 #39
0
    private void OnEnable()
    {
        managerSerialized = new SerializedObject(target);
        manager = (AttackManager)target;

        attacks = managerSerialized.FindProperty("attacks");
        inputs = managerSerialized.FindProperty("inputs");
        open = managerSerialized.FindProperty("open");

        attackScripts = LoadAttackScripts();
        confirmAdd = false;
    }
예제 #40
0
 private void OnSelectionChange()
 {
     if (Selection.activeGameObject != null && Selection.activeGameObject.GetComponent<UltimateAttackManager>() != null)
     {
         SelectCharacter(Selection.activeGameObject.GetComponent<AttackManager>());
     }
     else
     {
         myManager = null;
     }
     Repaint();
 }
예제 #41
0
    protected override void Awake()
    {
        base.Awake();

        // create states
        CreateState(SpawningState, SpawningEnter, info => {});
        CreateState(IdlingState, IdlingEnter, IdlingExit);
        CreateState(JumpingState, JumpingEnter, info => {});
        CreateState(MovingState, MovingEnter, MovingExit);
        CreateState(FallingState, FallingEnter, FallingExit);
        CreateState(AttackingState, AttackingEnter, info => {});
        CreateState(UltimateState, UltimateEnter, UltimateExit);
        CreateState(DefendingState, DefendingEnter, DefendingExit);
        CreateState(DodgeRollingState, DodgeRollingEnter, DodgeRollingExit);
        CreateState(AirDodgingState, AirDodgingEnter, AirDodgingExit);
        CreateState(FlinchingState, FlinchingEnter, FlinchingExit);
        CreateState(StunState, StunEnter, info => {});
        CreateState(DyingState, info => {}, info => {});

        initialState = SpawningState;

        myStats.Initialize(playerInfo.username);

        // combat
        attackManager = GetComponent<AttackManager>();
        attackManager.Initialize(this);
        comboManager = GetComponent<ComboManager>();
        comboManager.Initialize(this);
        tauntManager = GetComponent<TauntManager>();
        ultimateManager = GetComponent<UltimateAttackManager>();
        shieldHealth = (int)myStats.defenseShield.value;
        myMagic = GetComponent<Magic>();
        myMagic.Initialize(myStats);
        shieldRegen = new Job(RegenShield(), false);
    }
예제 #42
0
파일: AttackManager.cs 프로젝트: wHo2/TMC
	// Use this for initialization
	void Start () {
        AttackManager.Instance = this;
        EnemyAttackID = 0;
        AttackID = 0;
	}
예제 #43
0
    void OnEnable()
    {
        flying = true;
        EnemyManager.instance.OnBuff += UpdateBarriers;
        EnemyManager.instance.OnBuff += Buff;
        target = Player.instance.positionController.transform;
        attackManager = GetComponent<AttackManager> ();
        attackManager.collisionDetection.OnDeath += RemoveEvents;
        AreaEnemySpawner.instance.OnStateChange += RemoveEvents;
        EnemyManager.instance.NotifyNewEnemy (attackManager);

        barrierSpawner = GetComponent<BarrierSpawner> ();
        turretBarrierSpawner = GetComponent<TurretBarrierSpawner> ();
        UpdateBarriers ();
        Buff ();

        if (stationaryPosition != null)
            state = StationaryRoaming;
        else
            state = Roaming;
    }