Esempio n. 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item Sword
        if (other.tag == "Player")
        {
            stat = other.GetComponent <StatCollectionClass>();

            Up = other.GetComponent <ItemUpgrade>();

            Destroy(this.gameObject);


            // set item sword unlocked
            stat.itemSword = true;

            Up.SwordLevel++;

            Up.SwordDamage += 100f;

            //if no equipment now just equip sword to player
            if (stat.ArmorEquip == false && stat.BowEquip == false)
            {
                //add player attack damage with SwordDamage
                stat.damage += Up.SwordDamage;

                //set sword equip to true
                stat.SwordEquip = true;
            }
        }

        // Destroy the item
    }
Esempio n. 2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Enemy")
        {
            enemyStat = col.GetComponent <StatCollectionClass>();

            enemyStat.health -= playerStat.EnergyBalldamage;

            if (enemyStat.health <= 0)
            {
                Destroy(col.gameObject);
            }

            this.onExplosion();

            Destroy(gameObject);
        }

        if (col.gameObject.tag == "wallTop" || col.gameObject.tag == "wallBottom" ||
            col.gameObject.tag == "wallLeft" || col.gameObject.tag == "wallRight" ||
            col.gameObject.tag == "Rock1" || col.gameObject.tag == "Rock2")
        {
            this.onExplosion();

            Destroy(gameObject);
        }
    }
Esempio n. 3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item Sword
        if (other.tag == "Player") {

            stat=other.GetComponent<StatCollectionClass>();

            Up = other.GetComponent<ItemUpgrade>();

            Destroy(this.gameObject);

            // set item sword unlocked
            stat.itemSword = true;

            Up.SwordLevel++;

            Up.SwordDamage+=100f;

            //if no equipment now just equip sword to player
            if(stat.ArmorEquip==false &&stat.BowEquip==false)
            {

                //add player attack damage with SwordDamage
                stat.damage+=Up.SwordDamage;

                //set sword equip to true
                stat.SwordEquip= true;
            }

            }

            // Destroy the item
    }
Esempio n. 4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with bow
        if (other.tag == "Player")
        {
            stat = other.GetComponent <StatCollectionClass>();
            Up   = other.GetComponent <ItemUpgrade>();
            // set item bow unlocked
            stat.itemBow = true;

            Up.BowLevel++;

            Up.BowDamage += 50;

            if (stat.ArmorEquip == false && stat.SwordEquip == false)
            {
                //add player attack damage with bow damage
                stat.damage += Up.BowDamage;

                stat.BowEquip = true;
            }
        }

        // Destroy the item
        Destroy(this.gameObject);
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     //player = GameObject.FindWithTag("Player");
     rBody = GetComponent<Rigidbody2D> ();
     enemyStat = gameObject.GetComponent<StatCollectionClass> ();
     //playerStat = player.GetComponent<StatCollectionClass> ();
 }
Esempio n. 6
0
    //private CharacterJoint chMotor;

    void Start()
    {
        player     = GameObject.FindWithTag("Player");
        playerStat = player.GetComponent <StatCollectionClass> ();
        barLength  = Screen.width / 7;
        //chMotor = GetComponent(CharacterJoint);
    }
Esempio n. 7
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item armor
        if (other.tag == "Player")
        {
            stat = other.GetComponent <StatCollectionClass>();

            // set item armor unlocked
            stat.itemArmor = true;

            Up = other.GetComponent <ItemUpgrade>();

            Up.ArmorLevel++;

            Up.ArmorDamage += 50f;

            //if not equipment now just equip it
            if (stat.SwordEquip == false && stat.BowEquip == false)
            {
                //add player defend with armor defend
                stat.defend += Up.ArmorDamage;
                //set armor equip true
                stat.ArmorEquip = true;
            }

            // Destroy the item
            Destroy(this.gameObject);
        }
    }
Esempio n. 8
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Enemy") {

            enemyStat = col.GetComponent<StatCollectionClass>();

            enemyStat.health-=playerStat.EnergyBalldamage;

            if(enemyStat.health <= 0)
            {
                Destroy(col.gameObject);
            }

            this.onExplosion();

            Destroy (gameObject);

        }

        if (col.gameObject.tag == "wallTop"||col.gameObject.tag == "wallBottom"
            ||col.gameObject.tag == "wallLeft"|| col.gameObject.tag == "wallRight"
            ||col.gameObject.tag == "Rock1"||col.gameObject.tag == "Rock2") {

            this.onExplosion();

            Destroy (gameObject);

        }
    }
Esempio n. 9
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Enemy") {

            enemyStat = col.GetComponent<StatCollectionClass>();

            enemyStat.doDamage(skill.FireBallDamage);
            /*
            if(enemyStat.health <= 0)
            {
                Destroy(col.gameObject);
            }
            */
            this.onExplosion();

            Destroy (gameObject);

        }

        if (col.gameObject.tag == "Obstacle") {

            this.onExplosion();

            Destroy (gameObject);

        }
    }
Esempio n. 10
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with item armor
        if (other.tag == "Player") {

            stat=other.GetComponent<StatCollectionClass>();

            // set item armor unlocked
            stat.itemArmor = true;

            Up = other.GetComponent<ItemUpgrade>();

            Up.ArmorLevel++;

            Up.ArmorDamage+=1f;

            //if not equipment now just equip it
            if(stat.SwordEquip ==false && stat.BowEquip==false)
            {
                //add player defend with armor defend
                stat.defend+=Up.ArmorDamage;
                //set armor equip true
                stat.ArmorEquip = true;
            }

            // Destroy the item
            Destroy(this.gameObject);

        }
    }
Esempio n. 11
0
 //private CharacterJoint chMotor;
 void Start()
 {
     player = GameObject.FindWithTag ("Player");
     playerStat = gameObject.GetComponent<StatCollectionClass> ();
     barLength = Screen.width / 8;
     //chMotor = GetComponent(CharacterJoint);
 }
Esempio n. 12
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // If player collided with bow
        if (other.tag == "Player") {
            stat=other.GetComponent<StatCollectionClass>();
            Up = other.GetComponent<ItemUpgrade>();
            // set item bow unlocked
            stat.itemBow = true;

            Up.BowLevel++;

            Up.BowDamage+=0.5f;

            if (stat.ArmorEquip == false && stat.SwordEquip == false) {

                //add player attack damage with bow damage
                stat.damage += Up.BowDamage;

                stat.BowEquip = true;
            }
        }

        // Destroy the item
        Destroy(this.gameObject);
    }
Esempio n. 13
0
 public void copyStats(StatCollectionClass target)
 {
     //	godMode = target.godMode;
     health = target.health;
     initialHealth = target.initialHealth;
     mana = target.mana;
     initialMana = target.initialMana;
     damage = target.damage;
     baseMeleeDamage = target.baseMeleeDamage;
     baseRangedDamage = target.baseRangedDamage;
     baseMagicDamage = target.baseMagicDamage;
     defend = target.defend;
     baseDefense = target.baseDefense;
     strength = target.strength;
     intellect = target.intellect;
     agility = target.agility;
     xp = target.xp;
     playerLevel = target.playerLevel;
     itemSword = target.itemSword;
     SwordEquip = target.SwordEquip;
     itemArmor = target.itemArmor;
     ArmorEquip = target.ArmorEquip;
     itemBow = target.itemBow;
     BowEquip = target.BowEquip;
     FireBallUnlocked = target.FireBallUnlocked;
     FireBreathUnlocked = target.FireBreathUnlocked;
     SunStrikeUnlocked = target.SunStrikeUnlocked;
 }
Esempio n. 14
0
    void OnTriggerEnter2D(Collider2D other)
    {
        string tag = other.gameObject.tag;

        // If it collided with an enemy
        if (tag == "Enemy") {

            //Damage enemy
            //enemy health -= player attack;
            // Destroy the enemy
            enemyStat = other.GetComponent<StatCollectionClass>();
            enemyStat.health = enemyStat.health - playerStat.intellect;
            if(enemyStat.health <= 0)
            {
                Destroy(other.gameObject);
            }

            // And destroy the bullet
            Destroy(this.gameObject);
        }
        if (tag == "Wall" || tag == "Obstacle")
        {
            //Destroy the bullet
            Destroy(this.gameObject);
        }
    }
Esempio n. 15
0
    //AudioSource audio;
    void Start()
    {
        player = GameObject.FindWithTag ("Player");

        playerStat = player.GetComponent<StatCollectionClass >();

        Destroy(gameObject, 2f);
    }
Esempio n. 16
0
 // public GameObject deadsound;
 // Use this for initialization
 void Start()
 {
     rBody = GetComponent<Rigidbody2D> ();
     playerStat = gameObject.GetComponent<StatCollectionClass> ();
     playerStat.health = 100;
     playerStat.mana = 100;
     playerStat.intellect = 1;
 }
Esempio n. 17
0
    //AudioSource audio;

    void Start()
    {
        player = GameObject.FindWithTag("Player");

        playerStat = player.GetComponent <StatCollectionClass>();

        Destroy(gameObject, 2f);
    }
Esempio n. 18
0
    // public GameObject projectile;

    // Use this for initialization
    void Start()
    {
        anim                       = GetComponent <Animator> ();
        startPosition              = new Vector3(120, 0, -1);
        playerStat                 = gameObject.GetComponent <StatCollectionClass>();
        playerStat.health          = 100;
        playerStat.mana            = 100;
        playerStat.intellect       = 1;
        playerStat.playerDirection = 2;
    }
Esempio n. 19
0
 // public GameObject projectile;
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator> ();
     startPosition = new Vector3(120, 0, -1);
     playerStat = gameObject.GetComponent<StatCollectionClass>();
     playerStat.health = 100;
     playerStat.mana = 100;
     playerStat.intellect = 1;
     playerStat.playerDirection = 2;
 }
Esempio n. 20
0
    //connect to each script
    void Start()
    {
        player = this.gameObject;

        stat = player.GetComponent <StatCollectionClass>();

        psg = player.GetComponent <PlayerStateGUI> ();

        quest = player.GetComponent <All_Quests> ();
    }
Esempio n. 21
0
    void Start()
    {
        player = this.gameObject;

        stat = player.GetComponent <StatCollectionClass>();

        skill = player.GetComponent <SkillTree>();

        quest = player.GetComponent <All_Quests> ();

        item = player.GetComponent <ItemGUI>();
    }
Esempio n. 22
0
    void Start()
    {
        player = this.gameObject;

        stat = player.GetComponent<StatCollectionClass >();

        skill = player.GetComponent<SkillTree >();

        quest = player.GetComponent<All_Quests> ();

        item = player.GetComponent<ItemGUI>();
    }
Esempio n. 23
0
    void Start()
    {
        player = this.gameObject;

        stat = player.GetComponent<StatCollectionClass >();

        skill = player.GetComponent<SkillTree >();

        quest = player.GetComponent<All_Quests> ();

        ps = player.GetComponent<PlayerStateGUI>();

        up = player.GetComponent<ItemUpgrade> ();
    }
Esempio n. 24
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Enemy") {

            enemyStat= col.GetComponent<StatCollectionClass>();

            enemyStat.doDamage(40);

            if(enemyStat.health==0 && enemyStat.initialHealth>0)
            {
                Destroy(col);
            }
        }
    }
Esempio n. 25
0
    private void AssignModifiers(AIConfig ai)
    {
        StatCollectionClass toSet = gameObject.GetComponent <StatCollectionClass> ();

        //toSet.initialHealth = 100.0f;

        if (ai.healthMultiplier > 0)
        {
            toSet.initialHealth = toSet.health * ai.healthMultiplier;
            toSet.health        = toSet.initialHealth;
            Debug.Log("Assigning health");
        }
        else
        {
            Debug.LogError("Health and health multiplier must be intialized before applying AssignModifiers.");
        }

        if (ai.attackMultiplier > 0)
        {
            toSet.baseMeleeDamage  = toSet.strength * ai.attackMultiplier;
            toSet.baseRangedDamage = toSet.intellect * ai.attackMultiplier;
            Debug.Log("Assigning baseattack");
        }
        else
        {
            Debug.LogError("Strength/Intellect and attack multiplier must be intialized before applying AssignModifiers.");
        }

        if (toSet.strength > 0 && toSet.intellect > 0)
        {
            toSet.baseDefense = toSet.strength / 2 + toSet.intellect / 2;
            Debug.Log("Assigning basedefense");
        }
        else
        {
            Debug.LogError("Strength and intellect must be intialized before applying AssignModifiers.");
        }

        if (ai.manaMultiplier > 0)
        {
            toSet.initialMana = toSet.intellect * ai.manaMultiplier;
            toSet.mana        = toSet.initialMana;
            Debug.Log("Assigning mana");
        }
        else
        {
            Debug.LogError("intellect and mana multiplier must be intialized before applying AssignModifiers.");
        }
    }
Esempio n. 26
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Enemy") {

            enemyStat = col.GetComponent<StatCollectionClass>();

            enemyStat.health-=skill.EnergyBalldamage;

            Destroy (gameObject);

        }

        if (col.gameObject.tag == "wallTop"||col.gameObject.tag == "wallBottom"
            ||col.gameObject.tag == "wallLeft"|| col.gameObject.tag == "wallRight"
            ||col.gameObject.tag == "Obstacle") {

            Destroy (gameObject);

        }
    }
Esempio n. 27
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        // If player collides with an enemy they take damage
        if (collision.gameObject.tag == "Enemy")
        {
            StatCollectionClass enemyStat = collision.gameObject.GetComponent <StatCollectionClass>();
            playerStat.health = playerStat.health - enemyStat.intellect;
        }

        if (playerStat.health <= 0)
        {
            transform.position = startPosition;
            playerStat.health  = playerStat.initialHealth;
            playerStat.mana    = playerStat.initialMana;
            //Reset ();
            //Instantiate(deadsound);
            //Destroy(gameObject);
            //GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 - 25, 100, 50), " You Dead!!!!! ");

            //Application.LoadLevel(Application.loadedLevel);
        }
    }
Esempio n. 28
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /*
     *      Function to assign stats from our normalized sum, to their variables in our collection of stats.
     *      Apply any stat modifiers to de-normalize the values in the array. These will be balance constants.
     *      IN: int array of finalized stats, a reference to the statcollection being assigned
     *      OUT: Changes stat collection by reference, no returns.
     */
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    private void AssignStats(int[] split)
    {
        if (numOfStats < 3)
        {
            return;
        }

        StatCollectionClass toSet = gameObject.GetComponent <StatCollectionClass> ();

        /// Health
        toSet.health = split[0];
        /// Strength
        toSet.strength = split [1];
        /// Intellect
        toSet.intellect = split [2];
        /// XP
        toSet.xp = toSet.strength + toSet.intellect;
        /// Level
        toSet.playerLevel = sumArray(split);

        print(toSet.ToString());
    }
Esempio n. 29
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.tag == "Enemy") {

            enemyStat = col.GetComponent<StatCollectionClass>();

            enemyStat.doDamage(skill.SunStrikeDamage);

            this.onExplosion();

            Destroy (gameObject);

        }

        if (col.gameObject.tag == "wallTop"||col.gameObject.tag == "wallBottom"
            ||col.gameObject.tag == "wallLeft"|| col.gameObject.tag == "wallRight"
            ||col.gameObject.tag == "Obstacle") {

            this.onExplosion();

            Destroy (gameObject);

        }
    }
Esempio n. 30
0
    private void AssignStats(int[] split, StatCollectionClass member)
    {
        if (numOfStats < 6) {
            return;
        }

        /// Health
        member.GetComponent<StatCollectionClass>().health = split[0] * healthMul;
        /// Mana
        member.GetComponent<StatCollectionClass>().mana = split [1];
        /// Strength
        member.GetComponent<StatCollectionClass>().strength = split [2];
        /// Intellect
        member.GetComponent<StatCollectionClass>().intellect = split [3];
        /// XP
        member.GetComponent<StatCollectionClass>().xp = split [4];
        /// Level
        member.GetComponent<StatCollectionClass>().playerLevel = split [5];

        print(member.ToString ());
    }
Esempio n. 31
0
 // public GameObject projectile;
 // Use this for initialization
 void Start()
 {
     anim = GetComponent<Animator> ();
     flamethrower = gameObject.GetComponentInChildren<ParticleSystem>();
     flameEmmision = flamethrower.gameObject;
     startPosition = new Vector3(-120, 0, -1);
     playerStat = gameObject.GetComponent<StatCollectionClass>();
     playerStat.health = 100;
     playerStat.mana = 100;
     playerStat.intellect = 1;
     playerStat.playerDirection = 2;
     attackSound = GetComponent<AudioSource>();
     SLC = GameObject.Find("Main Camera").GetComponent<StoryLineComponents>();
     lavaGenerator = GameObject.Find("Main Camera").GetComponent<Lava2Generate>();
     D = GetComponent<Dialogue>();
     townPosition = new Vector3 (137f, -46f, -1f);
 }
Esempio n. 32
0
    //connect to each script
    void Start()
    {
        player = this.gameObject;

        stat = player.GetComponent<StatCollectionClass >();

        psg = player.GetComponent<PlayerStateGUI> ();

        quest = player.GetComponent<All_Quests> ();
    }
Esempio n. 33
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /*
        The AIBuilder method creates a config for a AI enabled entity.
        Currently it psuedorandomly assigns stats, eventually options for chosen stats and weighted random stats
        will be added.
        The AIBuilder will require switch logic to pick a set of nonconflicting behaviors.
    */
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public AIConfig AIBuilder(StatCollectionClass member, string type, int rWeight)
    {
        bool AImade = false;
        bool isMelee = false;
        bool isAggressive = false;
        bool isStalker = false;
        bool hasMagic = false;
        bool isCautious = false;

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /*
            We need to vary the stats based on weight.
            Look at the weight and see if the even split (average) is between the values is over statMax (our maximum
            normalized stat value).
            If it is, assign randomly from a range between statmin to statMax.
            Otherwise assign randomly statmin to the dividend of weight total with # of stats and add the modulus
            remainder. This will give stats that fairly equalized to the weight. Let AdjustStats fix any underages or
            overages.
        */
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        int[] split = new int[numOfStats];

        if ((rWeight / numOfStats) > maxStatValue) { //Upper bound on stats, might not be needed if things are weighted right.
            int remain = rWeight;
            for (int i = 0; i < numOfStats; i++) {
                split [i] = Random.Range (minStatValue, maxStatValue);
                //For Testing: print ("Random value for stat #" + i.ToString () + " : " + split [i].ToString ());
                remain = remain - split [i];
            }
        } else {
            for (int i = 0; i < numOfStats; i++) {
                split [i] = Random.Range (minStatValue, (rWeight / numOfStats) + rWeight % numOfStats);
                //For Testing: print ("Random value for stat #" + i.ToString () + " : " + split [i].ToString ());
            }
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /*
         	Sum all the stats together to so we can compare it to weight.
         	Calculate the expected sum and actual sum diff for our AdjustStats call.
        */
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        int sumR;
        AdjustStats (split, rWeight);

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /*
             Finally check that the final sum is correct.
         	 If the sum is correct set AImade true and carry on!
             Otherwise throw nasty errors and annoy us.
             TODO Have this loop back to AdjustStats, error if it fails to properly adjust it again.(We should never
             hit this second call ideally.)
        */
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        //Testing
        for(int j = 0; j < numOfStats; j++){
            //print("Final random stats" + split[j].ToString());
        }
        //

        sumR = sumArray (split);
        //print ("The sum is " + sumR.ToString () + " It is supposed to be " + rWeight.ToString ());

        if (sumR == rWeight) {
            AImade = true;
        }

        if (AImade) {
            AssignStats(split, member);
        } else {
            Debug.LogError ("AIManager failed to create a proper AIBuild");
        }

        switch(type){
        case "mob":
            if(member.health > 0){
                //Visual adjustments for health thresholds.
            }
            if(member.mana > 0){
                //Visual adjustments for mana thresholds.
                hasMagic = true;
            }
            if(member.strength > 6){
                isMelee = true;
                isAggressive = true;
                //Visual adjustments for being melee.
            }
            if(member.intellect > 6 && member.strength >= member.intellect){
                isCautious = true;
                //Visual adjustments for being cautious.
            }
            if(member.intellect > 6 && member.intellect >= member.strength){
                isStalker = true;
                //Visual adjustments for being a stalker.
            }
            break;
        case "npc":
            break;
        case "boss":
            break;
        default:
            Debug.LogError (type + ": is not a supported type.");
            break;
        }

        AIConfig config = new AIConfig();

        config.isMelee = isMelee;
        config.hasMagic = hasMagic;
        config.isAggressive = isAggressive;
        config.isCautious = isCautious;
        config.isStalker = isStalker;
        config.isMade = AImade;

        print(config.ToString ());

        return config;
    }
Esempio n. 34
0
    // Use this for initialization
    void Start()
    {
        //Q2.setGoToTown(false);

        winPos = new Rect ((Screen.width / 2) - Screen.width / 4, (Screen.height / 2) - Screen.height / 4, Screen.width / 2, Screen.height / 2);

        //winPos = new Rect (this.transform.position.x + 355, this.transform.position.y + 412, 500, 200);
        //boxPos = new Rect ((Screen.width / 2) - Screen.width / 4, (Screen.height / 2) - Screen.height / 4, Screen.width / 2, Screen.height / 2);

        //Quests Components:
        AllQuests = gameObject.GetComponent<All_Quests>();
        Q4 = gameObject.GetComponent<Quest4>();
        Q3 = gameObject.GetComponent<Quest3>();
        Q2 = gameObject.GetComponent<Quest2>();
        Q1 = gameObject.GetComponent<Quest1>();

        playerStat = GetComponent<StatCollectionClass>();

        Arrow = GameObject.Find ("Arrow");

        //SpeechBubble:
        speechBubble.SetActive(false);
        speechPos = speechBubble.transform.position;

        FrontGate1.SetActive (true);
        FrontGate2.SetActive (false);
        FrontGate3.SetActive (false);

        BackGate1.SetActive (true);
        BackGate2.SetActive (false);
        BackGate3.SetActive (false);

        townDone = false;

        freezePos = false;

        Q3P1 = false;
        Q3P2 = false;

        //Dialogue Array:

        //Mathius/Player Dialogue:
        Dl [0] = "\nHello!\n my name is Mathius, in all the chaos I seem to have lost my bag!\n Could you find it for me?";
        Dl [1] = "\nSure, I can get it!"; 		//player dialogue
        Dl [2] = "\nReturn it to me and I'll give you a reward for your efforts!...\n and If you see my friend Elizabeth tell her I'm okay, \n we got separated after the skyfall";
        Dl [3] = "\nThanks\n here's some gold coins,\n may they aid you on your journey...";

        //Elizabeth/Player Dialogue:
        Dl[4] = "\nHello\n My name is Elizabeth\n have you seen my friend Mathius?!";
        Dl[5] = "\nYes I have, he wanted me to tell you he's okay!"; //player dialogue
        Dl[6] = "\nThanks! I was very worried! \n you should head over to Birdtown,\n it's been steeped in turmoil since the skyfall\n here's a town pass, since the skyfall you'll need it to pass through the gate";
        Dl[7] = "\nThanks, I'll check it out!";

        //Guard1 Dialogue:
        Dl[8] = "\nWho Goes There!";
        Dl[9] = "\nI'm just a traveller, looking for General E. Speaking..."; // player dialogue
        Dl[10] = "\nYou don't have a town pass AND the entry fee, \nYOU \nSHALL NOT \nPASS! \n come back when you have both!";
        Dl[11] = "\nI have a town pass and enough coins to pay the entry fee"; //player dialogue
        Dl[12] = "\nhmm.. looks like you have the required items, \nyou may enter, \n OPEN THE GATE!";
        Dl[13] = "\nIt's too dangerous to leave the gate open at this time\n CLOSE THE GATE!!";

        /*************************
         * will need to change where new lines are depending on resolution
         * for the below dialogue
         * ************************/

        // townRobot Dialogue (QuestGiver3)
        Dl[14] = "\n*Beep* *Boop*\n I was right, General E. Speaking is just\n past the back gate. He's working from his \ncrashed space shuttle. Go talk to Selina, she can \ngive you a key for the back gate";
        Dl[15] = "\nOkay I'l go and speak with her!"; // player
        Dl[16] = "\n*Beep* *Boop*\nOh! I almost forgot! here's something to\n make you feel a bit better!";

        // Selina (town)
        Dl[17] = "\nHello Stranger, how can I help you?";
        Dl[18] = "\nGigabyte sent me, he said you could give me the key to the back gate?"; //player
        Dl[19] = "\nah yes! here, take it, I just hope you can stop \nGeneral E. Speaking before it's too late...";

        //Guard 2 Dialogue
        //Negative
        Dl [20] = "\n If you don't have a key, I can't open the gate for you,\n try talking so Selina, she might \n be able to give you one";
        //Postitive
        Dl[21] = "\n I have the key, please open the gate for me"; //player
        Dl[22] = "\n Your minimap won't work in General E. Speaking's dungeon, \nGoodluck!";
    }
Esempio n. 35
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    /*
     *      The AIBuilder method creates a config for a AI enabled entity.
     *      Currently it psuedorandomly assigns stats, eventually options for chosen stats and weighted random stats
     *      will be added.
     *      The AIBuilder will require switch logic to pick a set of nonconflicting behaviors.
     */
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public AIConfig AIBuilder(string type, int rWeight)
    {
        if (rWeight > (maxStatValue * numOfStats))
        {
            Debug.LogError("Weight is too high for the number of stats given their maximums.");
            Debug.Break();
        }
        StatCollectionClass member = gameObject.GetComponent <StatCollectionClass>();

        decisionType = type;
        bool AImade       = false;
        bool isMelee      = false;
        bool isHybrid     = false;
        bool isAggressive = false;
        bool isStalker    = false;
        bool hasMagic     = false;
        bool isCautious   = false;

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /*
         *      We need to vary the stats based on weight.
         *      Look at the weight and see if the even split (average) is between the values is over statMax (our maximum
         *      normalized stat value).
         *      If it is, assign randomly from a range between statmin to statMax.
         *      Otherwise assign randomly statmin to the dividend of weight total with # of stats and add the modulus
         *      remainder. This will give stats that fairly equalized to the weight. Let AdjustStats fix any underages or
         *      overages.
         */
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        int[] split = new int[numOfStats];

        if ((rWeight / numOfStats) > maxStatValue)           //Upper bound on stats, might not be needed if things are weighted right.
        {
            int remain = rWeight;
            for (int i = 0; i < numOfStats; i++)
            {
                split [i] = Random.Range(minStatValue, maxStatValue);
                //For Testing: print ("Random value for stat #" + i.ToString () + " : " + split [i].ToString ());
                remain = remain - split [i];
            }
        }
        else
        {
            for (int i = 0; i < numOfStats; i++)
            {
                split [i] = Random.Range(minStatValue, (rWeight / numOfStats) + rWeight % numOfStats);
                //For Testing: print ("Random value for stat #" + i.ToString () + " : " + split [i].ToString ());
            }
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /*
         *      Sum all the stats together to so we can compare it to weight.
         *      Calculate the expected sum and actual sum diff for our AdjustStats call.
         */
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        int sumR;

        AdjustStats(split, rWeight);

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        /*
         *       Finally check that the final sum is correct.
         *       If the sum is correct set AImade true and carry on!
         *       Otherwise throw nasty errors and annoy us.
         *       TODO Have this loop back to AdjustStats, error if it fails to properly adjust it again.(We should never
         *       hit this second call ideally.)
         */
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        //Testing
        //for(int j = 0; j < numOfStats; j++){
        //print("Final random stats" + split[j].ToString());
        //}
        //

        sumR = sumArray(split);
        //print ("The sum is " + sumR.ToString () + " It is supposed to be " + rWeight.ToString ());

        if (sumR == rWeight)
        {
            AImade = true;
        }


        if (AImade)
        {
            AssignStats(split);
        }
        else
        {
            Debug.LogError("AIManager failed to create a proper AIBuild");
        }

        AIConfig config = new AIConfig();

                #pragma warning disable
        BehaviorTypes assignBehavior = new BehaviorTypes();
                #pragma warning restore

        switch (type)
        {
        case "mob":
            if (member.health > 0)
            {
                //Visual adjustments for health thresholds.
            }
            if (member.mana > 0)
            {
                //Visual adjustments for mana thresholds.
                hasMagic = true;
            }
            if (member.strength > 6)
            {
                isMelee      = true;
                isAggressive = true;
                //Visual adjustments for being melee.
            }
            if (member.intellect > 6 && member.strength >= member.intellect)
            {
                isCautious = true;
                isHybrid   = true;
                //Visual adjustments for being cautious.
            }
            if (member.intellect > 6 && member.intellect >= member.strength)
            {
                isStalker = true;
                //Visual adjustments for being a stalker.
            }

            config.isMelee      = isMelee;
            config.isHybrid     = isHybrid;
            config.hasMagic     = hasMagic;
            config.isAggressive = isAggressive;
            config.isCautious   = isCautious;
            config.isStalker    = isStalker;

            if (isHybrid)
            {
                config = assignBehavior.intializeHybridGeneric(config);
            }
            else if (isMelee)
            {
                config = assignBehavior.intializeMeleeGeneric(config);
            }
            else
            {
                config = assignBehavior.intializeRangedGeneric(config);
            }


            AssignModifiers(config);
            config.isMade = AImade;
            break;

        case "npc":
            //Stuff might go here?
            break;

        case "boss":
            //Boss mechanics to be decided.
            break;

        default:
            Debug.LogError(type + ": is not a supported type.");
            break;
        }


        print(config.ToString());

        return(config);
    }
Esempio n. 36
0
 // Use this for initialization
 void Start()
 {
     player = gameObject.GetComponent<StatCollectionClass>();
 }
Esempio n. 37
0
    public AIConfig AIBuilder(StatCollectionClass member, string type, int rWeight)
    {
        bool AImade = false;

        AIConfig config = new AIConfig();
        /*
         * TODO PICK AN AI TYPE
        switch(type){
        case "player":
        case "mob":
        case "npc":
        default:
            break;
        }
        */

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // We need to vary the stats based on weight.
        // Look at the weight and see if the even split between the values is over statMax.
        // If it is, assign randomly from statmin to statMax.
        // Otherwise assign randomly statmin to the dividend of weight total with # of stats and add the modulus
        // remainder.
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        int[] split = new int[numOfStats];

        if ((rWeight / numOfStats) > maxStatValue) {
            int remain = rWeight;
            for (int i = 0; i < numOfStats; i++) {
                split [i] = Random.Range (minStatValue, maxStatValue);
                //print ("Random value for stat #" + i.ToString () + " : " + split [i].ToString ());
                remain = remain - split [i];
            }
        } else {
            for (int i = 0; i < numOfStats; i++) {
                split [i] = Random.Range (minStatValue, (rWeight / numOfStats) + rWeight % numOfStats);
                //print ("Random value for stat #" + i.ToString () + " : " + split [i].ToString ());
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Sum all the stats together to so we can compare it to weight.
        // Calculate the expected sum and actual sum diff.
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        int sumR;

        AdjustStats (split, rWeight);

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Finally check that the sum is correct.
        // If the sum is correct set AImade true and carry on!
        // Otherwise throw nasty errors and annoy us.
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        for(int j = 0; j < numOfStats; j++){
            //print("Final random stats" + split[j].ToString());
        }

        sumR = sumArray (split);
        //print ("The sum is " + sumR.ToString () + " It is supposed to be " + rWeight.ToString ());

        if (sumR == rWeight) {
            AImade = true;
        }

        if (AImade) {
            AssignStats(split, member);
            return config;
        } else {
            Debug.LogError ("AIManager failed to create a proper AIBuild");
            return config;
        }
    }
Esempio n. 38
0
 public void AssignStats(int[] split, StatCollectionClass toSet)
 {
     if (numOfStats < 3) {
         return;
     }
     //StatCollectionClass toSet = stats.GetComponent<StatCollectionClass> ();
     /// Health
     toSet.health = split[0];
     /// Strength
     toSet.strength = split [1];
     /// Intellect
     toSet.intellect = split [2];
     /// XP
     toSet.xp = toSet.strength + toSet.intellect;
     /// Level
     toSet.playerLevel = sumArray(split);
 }
Esempio n. 39
0
 // Use this for initialization
 void Start()
 {
     rBody = GetComponent<Rigidbody2D> ();
     enemyStat = gameObject.GetComponent<StatCollectionClass> ();
 }