Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        tutorialDialog = this.transform.GetComponent <TutorialDialog>();
        player         = GameObject.Find("character1").GetComponent <Player>();
        craftSystem    = GameObject.Find("CraftSystem").GetComponent <CraftSystem>();
        pickWeapon     = GameObject.Find("PickWeapon").GetComponent <CPickWeapon>();
        trapSystem     = GameObject.Find("character2").GetComponent <TrapSystem>();
        tutorialDialog.tutorialRequest = this;
        Debug.Log(GameObject.Find("CraftSystem"));
        craftSystem.tutorialRequest = this;
        pickWeapon.tutorialRequest  = this;
        player.tutorialRequest      = this;
        trapSystem.tutorialRequest  = this;
        Transform tempProjectile = GameObject.Find("ProjectileSystem").transform;

        projectile = new Projectile[tempProjectile.childCount];
        for (int i = 0; i < projectile.Length; i++)
        {
            projectile[i] = tempProjectile.GetChild(i).GetComponent <Projectile>();
            projectile[i].tutorialRequest = this;
        }
    }
Beispiel #2
0
    private void OnMenuDisarmTrap(GameEvent e)
    {
        var data = (MenuSystem.MenuOptionSelected)e.EventData;

        TimedActionStarted(data.ActorID, RPGGameEvent.Menu_DisarmTrap, TrapSystem.ActionTimeToDisarmTrap(data.ItemID), true, data.ItemID);
    }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        theGridSystem     = GameObject.Find("PlayerTetrisGrid").GetComponent <GridSystem>();
        enemyGridSystem   = GameObject.Find("EnemyTetrisGrid").GetComponent <enemyGridSystem>();
        thePowerupsSystem = GameObject.Find("PowerUpSystem").GetComponent <PowerupsSystem>();
        if (!enemyGridSystem.multi)
        {
            theTrapSystem = GameObject.Find("TrapSystem").GetComponent <TrapSystem>();
        }


        thePlayer = GameObject.Find("Player");
        game      = GameObject.Find("EventSystem").GetComponent <GameCode>();

        health = this.gameObject.AddComponent <HealthSystem>();

        attackHeight     = 40;
        originPos        = transform.position;
        Pos              = originPos;
        canvasLocalScale = GameObject.FindGameObjectWithTag("Canvas").transform.localScale;


        //Attack adjacent tiles
        attackWidth = 150;



        //Debug.Log("Cavalry");
        if (type == "Cavalry")
        {
            health.InitHealth(PlayerPrefs.GetFloat("calvaryHP"));
            attckDmg = PlayerPrefs.GetFloat("calvaryAtt");
            attckSpd = PlayerPrefs.GetFloat("calvaryAttSpd");
            speed    = PlayerPrefs.GetFloat("calvarySpd");

            vision = 100;
            range  = 100;
            state  = (int)States.CHARGE;
            //prevhealth = health;
            activ  = true;
            _class = 3;
            if (terrainName == "Hills")
            {
                attckDmg = (attckDmg * game.TMV_Cavalry.attackDamage);
                speed    = (speed * game.TMV_Cavalry.speed);
                attckSpd = (attckSpd * game.TMV_Cavalry.attackSpeed);
            }
            else if (terrainName == "Forest")
            {
                attckDmg = (attckDmg * game.TMV_Cavalry.attackDamage);
                speed    = (speed * game.TMV_Cavalry.speed);
                attckSpd = (attckSpd * game.TMV_Cavalry.attackSpeed);
            }
            else if (terrainName == "River")
            {
                attckDmg = (attckDmg * game.TMV_Cavalry.attackDamage);
                speed    = (speed * game.TMV_Cavalry.speed);
                attckSpd = (attckSpd * game.TMV_Cavalry.attackSpeed);
            }
            else if (terrainName == "Plains")
            {
                attckDmg = (attckDmg * game.TMV_Cavalry.attackDamage);
                speed    = (speed * game.TMV_Cavalry.speed);
                attckSpd = (attckSpd * game.TMV_Cavalry.attackSpeed);
            }
        }
        else if (type == "Infantry")
        {
            // Debug.Log("Infantry");
            health.InitHealth(PlayerPrefs.GetFloat("infantryHP"));
            attckDmg = PlayerPrefs.GetFloat("infantryAtt", attckDmg);
            attckSpd = PlayerPrefs.GetFloat("infantryAttSpd");
            speed    = PlayerPrefs.GetFloat("infantrySpd");
            range    = 100;

            vision = 100;
            state  = (int)States.CHARGE;
            //prevhealth = health;
            activ  = true;
            _class = 1;
            if (terrainName == "Hills")
            {
                attckDmg = (attckDmg * game.TMV_Infantry.attackDamage);
                speed    = (speed * game.TMV_Infantry.speed);
                attckSpd = (attckSpd * game.TMV_Infantry.attackSpeed);
            }
            else if (terrainName == "Forest")
            {
                attckDmg = (attckDmg * game.TMV_Infantry.attackDamage);
                speed    = (speed * game.TMV_Infantry.speed);
                attckSpd = (attckSpd * game.TMV_Infantry.attackSpeed);
            }
            else if (terrainName == "River")
            {
                attckDmg = (attckDmg * game.TMV_Infantry.attackDamage);
                speed    = (speed * game.TMV_Infantry.speed);
                attckSpd = (attckSpd * game.TMV_Infantry.attackSpeed);
            }
            else if (terrainName == "Plains")
            {
                attckDmg = (attckDmg * game.TMV_Infantry.attackDamage);
                speed    = (speed * game.TMV_Infantry.speed);
                attckSpd = (attckSpd * game.TMV_Infantry.attackSpeed);
            }
        }
        else if (type == "Bowmen")
        {
            // Debug.Log("Bowmen");
            health.InitHealth(PlayerPrefs.GetFloat("bowmenHP"));
            attckDmg      = PlayerPrefs.GetFloat("bowmenAtt", attckDmg);
            attckSpd      = PlayerPrefs.GetFloat("bowmenAttSpd");
            speed         = PlayerPrefs.GetFloat("bowmenSpd");
            theProjectile = GetComponent <Projectile>();
            range         = 300;
            vision        = 300;
            state         = (int)States.CHARGE;
            //prevhealth = health;
            activ  = true;
            _class = 2;
            if (terrainName == "Hills")
            {
                attckDmg = (attckDmg * game.TMV_Bowmen.attackDamage);
                speed    = (speed * game.TMV_Bowmen.speed);
                attckSpd = (attckSpd * game.TMV_Bowmen.attackSpeed);
            }
            else if (terrainName == "Forest")
            {
                attckDmg = (attckDmg * game.TMV_Bowmen.attackDamage);
                speed    = (speed * game.TMV_Bowmen.speed);
                attckSpd = (attckSpd * game.TMV_Bowmen.attackSpeed);
            }
            else if (terrainName == "River")
            {
                attckDmg = (attckDmg * game.TMV_Bowmen.attackDamage);
                speed    = (speed * game.TMV_Bowmen.speed);
                attckSpd = (attckSpd * game.TMV_Bowmen.attackSpeed);
            }
            else if (terrainName == "Plains")
            {
                attckDmg = (attckDmg * game.TMV_Bowmen.attackDamage);
                speed    = (speed * game.TMV_Bowmen.speed);
                attckSpd = (attckSpd * game.TMV_Bowmen.attackSpeed);
            }
        }
        //Debug.Log(transform.position
    }