Inheritance: MonoBehaviour
Example #1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.CompareTag("Enemy") && e_PickupState != PickupState.ON_GROUND)
     {
         BasicEnemyBehavior enemy = other.gameObject.GetComponent <BasicEnemyBehavior>();
         enemy.DestroyEnemy();
     }
 }
Example #2
0
    private void SpawnEnemy()
    {
        GameObject         enemy         = (GameObject)Instantiate(m_EnemyType);
        BasicEnemyBehavior enemyBehavior = enemy.GetComponent <BasicEnemyBehavior>();

        enemy.transform.position = m_SpawnerPosition;
        enemyBehavior.m_DelayForStartingMovement = m_StartingMovementTime;
        enemyBehavior.m_SpeedPerSecond           = m_EnemySpeedPerSecond;
        enemyBehavior.m_StartingMovement         = new Vector3(
            m_EnemyStartingDirection.x + Random.Range(-m_StartingDirectionJitter.x, m_StartingDirectionJitter.x),
            m_EnemyStartingDirection.y + Random.Range(-m_StartingDirectionJitter.y, m_StartingDirectionJitter.y),
            m_EnemyStartingDirection.z + Random.Range(-m_StartingDirectionJitter.z, m_StartingDirectionJitter.z)
            );
    }
 public bool OnPlayerStruck(int damage, StrikeType strikeType, BasicEnemyBehavior source)
 {
     //Checks if the players block is active and if the block direction is equal to the direction of the hit received.
     if (!blockActive || blockDirection != strikeType)
     {
         playerStats.GetDamaged(damage);
         return(true);
     }
     else
     {
         //Checks if the player blocked for a short enough time to stagger the enemy. The time is detemined by the Players Equipment as defined in the PlayerCharacter
         bool wasPerfectBlock = (blockActiveTimer <= playerStats.GetActiveCharacter().staggerWindow);
         source.OnBlocked(wasPerfectBlock);
         return(false);
     }
 }
    public StrikeType[] vulnerabilityList = {}; //List of all Strike Directions that deal double damage

    void Start()
    {
        enemyBehavior = GetComponent <BasicEnemyBehavior>();
    }