AI Programming

The goal of the game is to survive as long as possible, you start with basic stats which you can upgrade by gaining exp. The more enemies you kill the stronger you become.

 

The characters are 3D models and animations found on the internet.

 

Features:

  • Enemy AI
  • AI difficulties
  • A* pathfinding
  • Character movement
  • Animations
  • Character upgrades
  • Game manager (and all sub-managers)
  • Experience
  • Character stats
  • Etc.

 

Example code:

 
using UnityEngine;
using System.Collections;

public class UpgradeManager : MonoBehaviour
{
    //--------------------
    //PRIVATE VARIABLES
    //--------------------
    
    //BASE VALUES
    private float _attackSpeed = 1.0f;
    private float _reloadSpeed = 1.0f;
    private float _extraHealth = 0.0f;
    private float _healthRegen = 0.0f;
    private float _extraArmor = 0.0f;
    private float _armorRegen = 0.0f;
    private int _extraAmmo = 0;

    //LEVELS OF UPGRADES
    private int _attackSpeedLevel = 0;
    private int _reloadSpeedLevel = 0;
    private int _extraHealthLevel = 0;
    private int _healthRegenLevel = 0;
    private int _extraArmorLevel = 0;
    private int _armorRegenLevel = 0;
    private int _extraAmmoLevel = 0;

    //MAXIMUM LEVEL
    private int _attackSpeedMaxLevel = 10;
    private int _reloadSpeedMaxLevel = 10;
    private int _extraHealthMaxLevel = 10;
    private int _healthRegenMaxLevel = 10;
    private int _extraArmorMaxLevel = 10;
    private int _armorRegenMaxLevel = 10;
    private int _extraAmmoMaxLevel = 10;

    //LEVEL MULTIPLIER
    private float _attackSpeedValue = 0.9f;
    private float _reloadSpeedValue = 0.9f;
    private float _extraHealthValue = 10.0f;
    private float _healthRegenValue = 0.5f;
    private float _extraArmorValue = 5.0f;
    private float _armorRegenValue = 0.5f;
    private int _extraAmmoValue = 2;

    //--------------------
    //PUBLIC FUNCTIONS
    //--------------------

    //FUNCTION TO RESET ALL THE VALUES
    public void Reset()
    {
        _attackSpeedLevel = 0;
        _reloadSpeedLevel = 0;
        _extraHealthLevel = 0;
        _healthRegenLevel = 0;
        _extraArmorLevel = 0;
        _armorRegenLevel = 0;
        _extraAmmoLevel = 0;
    }

    //FUNCTION TO LEVEL ATTACK SPEED
    public bool LevelAttackSpeed()
    {
        if (_attackSpeedLevel + 1 > _attackSpeedMaxLevel)
        {
            return false;
        }
        GameManager.SingleTon().GetExperienceManager().Upgraded();
        _attackSpeedLevel++;
        return true;
    }

    //FUNCTION TO LEVEL RELOAD SPEED
    public bool LevelReloadSpeed()
    {
        if (_reloadSpeedLevel + 1 > _reloadSpeedMaxLevel)
        {
            return false;
        }
        GameManager.SingleTon().GetExperienceManager().Upgraded();
        _reloadSpeedLevel++;
        return true;
    }

    //FUNCTION TO LEVEL MAXIMUM HEALTH
    public bool LevelExtraHealth()
    {
        if (_extraHealthLevel + 1 > _extraHealthMaxLevel)
        {
            return false;
        }
        GameManager.SingleTon().GetExperienceManager().Upgraded();
        _extraHealthLevel++;
        return true;
    }

    //FUNCTION TO LEVEL HEALTH REGEN
    public bool LevelHealthRegen()
    {
        if (_healthRegenLevel + 1 > _healthRegenMaxLevel)
        {
            return false;
        }
        GameManager.SingleTon().GetExperienceManager().Upgraded();
        _healthRegenLevel++;
        return true;
    }

    //FUNCTION TO LEVEL MAXIMUM ARMOR
    public bool LevelExtraArmor()
    {
        if (_extraArmorLevel + 1 > _extraArmorMaxLevel)
        {
            return false;
        }
        GameManager.SingleTon().GetExperienceManager().Upgraded();
        _extraArmor++;
        return true;
    }

    //FUNCTION TO LEVEL ARMOR REGEN SPEED
    public bool LevelArmorRegen()
    {
        if (_armorRegenLevel + 1 > _armorRegenMaxLevel)
        {
            return false;
        }
        GameManager.SingleTon().GetExperienceManager().Upgraded();
        _armorRegenLevel++;
        return true;
    }

    //FUNCTION TO LEVEL MAXIMUM AMMO
    public bool LevelExtraAmmo()
    {
        if (_extraAmmoLevel + 1 > _extraAmmoMaxLevel)
        {
            return false;
        }
        GameManager.SingleTon().GetExperienceManager().Upgraded();
        _extraAmmoLevel++;
        return true;
    }

    //RETRIEVE THE ATTACK SPEED
    public float GetAttackSpeed()
    {
        return _attackSpeed * Mathf.Pow(_attackSpeedValue, _attackSpeedLevel);
    }

    //RETRIEVE THE RELOAD SPEED
    public float GetReloadSpeed()
    {
        return _reloadSpeed * Mathf.Pow(_reloadSpeedValue, _reloadSpeedLevel);
    }

    //RETRIEVE THE EXTRA HEALTH FOR THE CHARACTER
    public float GetExtraHealth()
    {
        return _extraHealth + (_extraHealthValue * _extraHealthLevel);
    }

    //RETRIEVE THE HEALTH REGEN
    public float GetHealthRegen()
    {
        return _healthRegen + (_healthRegenValue * _healthRegenLevel);
    }

    //RETRIEVE THE EXTRA ARMOR
    public float GetExtraArmor()
    {
        return _extraArmor + (_extraArmorValue * _extraArmorLevel);
    }

    //RETRIEVE THE ARMOR REGEN SPEED
    public float GetArmorRegen()
    {
        return _armorRegen + (_armorRegenValue * _armorRegenLevel);
    }

    //RETRIEVE THE EXTRA AMMO
    public int GetExtraAmmo()
    {
        return _extraAmmo + (_extraAmmoValue * _extraAmmoLevel);
    }

}