Example #1
0
 void Start()
 {
     myRule = AttackRule.random;
     hideText();
     gc = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
     initComponents();
 }
Example #2
0
    public bUnit(BaseUnit unitType)
    {
        timesBuffed = 0;

        myType = unitType;

        myName = unitType.unitName;
        myRule = AttackRule.random;

        curHealth = unitType.health;
        maxHealth = curHealth;
        curAtk    = unitType.attack;
        curDef    = unitType.defense;

        curBuyCost    = unitType.buyCost;
        curDeployCost = unitType.deployCost;

        myMesh = unitType.mesh;
        myMat  = unitType.unitMat;

        //idleAnim = unitType.idleAnimation;

        switch (unitType.myDataType)
        {
        case dataType.basic:
            myData = new Metadata();
            break;

        case dataType.poison:
            myData = new poisonData();
            break;

        case dataType.swipe:
            myData = new bobData();
            break;

        case dataType.immune:
            myData = new poisonHealData();
            break;

        case dataType.dodge:
            myData = new dodgeData();
            break;

        default:
            Debug.Log("ERROR: unrecognized datatype from BaseUnit");
            break;
        }
    }
Example #3
0
    public void copyIn(Unit other)
    {
        mySlot = other.mySlot;
        myRule = other.myRule;
        myData = other.myData;

        myName = other.myName;

        unitType   = other.unitType;
        isFriendly = other.isFriendly;

        myMesh = other.myMesh;
        myMat  = other.myMat;

        curHealth = other.curHealth;
        curAtk    = other.curAtk;
        curDef    = other.curDef;

        curBuyCost    = other.curBuyCost;
        curDeployCost = other.curDeployCost;

        //myData = other.myData;
        switch (unitType.myDataType)
        {
        case dataType.basic:
            myData = new Metadata();
            break;

        case dataType.swipe:
            myData = new bobData();
            break;

        case dataType.poison:
            myData = new poisonData();
            break;

        default:
            Debug.Log("ERROR: metadata type not assigned or unrecognized");
            break;
        }

        initComponents();

        mf.mesh       = myMesh;
        mc.sharedMesh = myMesh;
        mr.material   = myMat;
        refreshText();
    }
    public void Setup(AttackRule attackRule, float attackRange)
    {
        this.attackRule = new StandardAttackRule();

        this.attackRange = attackRange;
    }
 void Start()
 {
     attackRange     = GetComponent <AttackHandler>().attackRange;
     attachedBaseObj = GetComponent <BaseObject>();
     this.attackRule = new StandardAttackRule();
 }