Example #1
0
    // Initiates the Knight class
    public void InitiateKnight()
    {
        // Sets the Game Manager
        Gm = GameObject.Find("Game Manager");
        GM = Gm.GetComponent <GameManager>();

        // Sets the Knight's class
        UnitClass = GetUnitClass(this.gameObject);
        // Knight has medium health
        MaxHealth = 50;
        Health    = 50;
        // Knight deals medium damage
        AttackDamage = 10;
        // Knight has close range
        Range = 3;
        // Knight has fast attack speed
        AttackSpeed = 1.5f; // 1 Second

        agent = this.gameObject.GetComponent <NavMeshAgent>();
    }
    // Initiates the Pikeman class
    public void InitiatePikeman()
    {
        // Sets the Game Manager
        Gm = GameObject.Find("Game Manager");
        GM = Gm.GetComponent <GameManager>();

        // Sets the Knight's class
        UnitClass = GetUnitClass(this.gameObject);
        // Pikeman has high health
        MaxHealth = 75;
        Health    = 75;
        // Pikeman deals low damage
        AttackDamage = 5;
        // Pikeman has close range
        Range = 3;
        // Pikeman has low attack speed
        AttackSpeed = 4f; // 4 Seconds

        agent = this.gameObject.GetComponent <NavMeshAgent>();
    }
Example #3
0
    // Initiates the Archer class
    public void InitiateArcher()
    {
        // Sets the Game Manager
        Gm = GameObject.Find("Game Manager");
        GM = Gm.GetComponent <GameManager>();

        // Sets the Knight's class
        UnitClass = GetUnitClass(this.gameObject);
        // Archer has low health
        MaxHealth = 25;
        Health    = 25;
        // Archer deals high damage
        AttackDamage = 20;
        // Archer has long range
        Range = 40;
        // Archer has low attack speed (Reload time)
        AttackSpeed = 5; // 5 Seconds
        // Arrows fly fast
        ProjectileSpeed = 100;

        agent = this.gameObject.GetComponent <NavMeshAgent>();
    }
Example #4
0
    // Initiates the Wizard class
    public void InitiateWizard()
    {
        // Sets the Game Manager
        Gm = GameObject.Find("Game Manager");
        GM = Gm.GetComponent <GameManager>();

        // Sets the Knight's class
        UnitClass = GetUnitClass(this.gameObject);
        // Wizard has low health
        MaxHealth = 25;
        Health    = 25;
        // Wizard deals medium damage
        AttackDamage = 7.5f;
        // Wizard has medium range
        Range = 25;
        // Wizard has medium attack speed
        AttackSpeed = 3f; // 3 Seconds
        // Spells fly slower
        ProjectileSpeed = 50;

        agent = this.gameObject.GetComponent <NavMeshAgent>();
    }