Beispiel #1
0
    public void OnPlayerAttacked(UnitEnemy _Enemy)
    {
        if (_Enemy != null)
        {
            m_Player.TakeDamages(1);
            m_Player.AttackEnemy();
        }

        /*
         * if (Application.isMobilePlatform)
         * {
         *  if (_Enemy != null)
         *  {
         *      SetInputMode(new InputMode_MeleeBattle());
         *  }
         *  else
         *  {
         *      SetInputMode(new InputMode_Movement());
         *  }
         * }
         * else
         * {
         *  if (_Enemy != null)
         *  {
         *      SetInputMode(new InputMode_MeleeBattleDebug());
         *  }
         *  else
         *  {
         *      SetInputMode(new InputMode_MovementDebug());
         *  }
         * }*/
    }
 public void SetAttackingEnemy(UnitEnemy _Enemy)
 {
     m_Enemy = _Enemy;
     for (int i = 0; i < m_OnPlayerAttackedEventRecievers.Count; i++)
     {
         m_OnPlayerAttackedEventRecievers[i].OnPlayerAttacked(m_Enemy);
     }
 }
Beispiel #3
0
 public void RemoveEnemy(UnitEnemy pUnitEnemy)
 {
     mUnitEnemyList.Remove(pUnitEnemy);
     if (mUnitHero.vTargetObject == pUnitEnemy.aTransform)
     {
         mUnitHero.vTargetObject = null;
     }
 }
Beispiel #4
0
 private void InternalLoadEnemies(I_Map _Map, List <EnemyData> _EnemyData)
 {
     for (int i = 0; i < _EnemyData.Count; i++)
     {
         UnitEnemy enemy = GameObject.Instantiate(Resources.Load <GameObject>("Entities/Enemy"), new Vector3(0, 0, 0), Quaternion.identity).GetComponent <UnitEnemy>();
         enemy.LoadFromData(_Map, _EnemyData[i]);
         m_Enemies.Add(enemy);
     }
 }
Beispiel #5
0
 private void InternalSpawnEnemyRandomly(I_Map _Map, int _Count)
 {
     for (int i = 0; i < _Count; i++)
     {
         UnitEnemy enemy = GameObject.Instantiate(Resources.Load <GameObject>("Entities/Enemy"), new Vector3(0, 0, 0), Quaternion.identity).GetComponent <UnitEnemy>();
         enemy.TeleportTo(_Map.GetRandomWalkableTile());
         m_Enemies.Add(enemy);
     }
 }
Beispiel #6
0
    public void TriggerStop()
    {
        SetButtons(true);
        CheckAvailableAttack();

        UnitEnemy unitEnemy = GetComponent <UnitEnemy>();

        if (unitEnemy != null)
        {
            SetDown(true);
            unitEnemy.TryAttack();
        }
    }
Beispiel #7
0
    private void ServerHandleEnemyDespawned(UnitEnemy unitEnemy)
    {
        enemies.Remove(unitEnemy);

        if (enemies.Count != 1)
        {
            return;
        }

        int playerId = enemies[0].connectionToClient.connectionId;

        RpcGameOver($"Player {playerId}");

        ServerOnGameOver?.Invoke();
    }
Beispiel #8
0
 public void Start()
 {
     vUnitEnemy = gameObject.GetComponent<UnitEnemy>();
     if (vUnitEnemy == null)
         Debug.LogError("This object is not exist UnitEnemy component. please check your component");
 }
Beispiel #9
0
 public void SetTarget(UnitEnemy pEnemy)
 {
     vTargetObject = pEnemy.aTransform;
 }
Beispiel #10
0
 void Start()
 {
     EnemyState = states.Idle;
     delay = Time.time;
     AIPathing = GetComponent<AIPathCustom>();
     controller = GetComponent<CharacterController>();
     GM= GameManager.Get();
     if (gameObject.tag == "Bat" || gameObject.tag == "Larva"){
         player = GM.objPlayer.transform;
         tmp = GetComponent<UnitEnemy>();
     }else if (gameObject.tag == "MechBoss"){
         StartCoroutine("bossAutoAttack");
     }
 }
 protected void Start()
 {
     TurnOrder.RegisterUnit(this);
     m_Enemy = GetComponent <UnitEnemy>();
 }
Beispiel #12
0
 public void AddEnemy(UnitEnemy pUnitEnemy)
 {
     pUnitEnemy.Init();
     mUnitEnemyList.Add(pUnitEnemy);
 }
Beispiel #13
0
 private void InternalRemoveEnemy(UnitEnemy _Enemy)
 {
     m_Enemies.Remove(_Enemy);
 }
Beispiel #14
0
 public static void RemoveEnemy(UnitEnemy _Enemy)
 {
     GetInstance().InternalRemoveEnemy(_Enemy);
 }
Beispiel #15
0
 private void ServerHandleEnemySpawned(UnitEnemy unitEnemy)
 {
     enemies.Add(unitEnemy);
 }