protected PunchController GetPunch()
    {
        var             attackType       = new PunchController().GetType();
        string          attackName       = (isPowerOn) ? "SuperPunchController" : "PunchController";
        GameObject      attackObject     = (GameObject)Instantiate(Resources.Load(attackPrefabName + attackName));
        PunchController attackController = (PunchController)attackObject.GetComponent(attackType);

        return(attackController);
    }
Пример #2
0
    protected override AttackController GetAttack()
    {
        attackAnimName = (attacks++ % 2 == 0) ? "Attacking2" : "Attacking";

        string attackName = (isPowerOn) ? "SuperPunch" : "Punch";
        var    attackType = new PunchController().GetType();

        GameObject      attackObject     = (GameObject)Instantiate(Resources.Load(attackPrefabName + attackName));
        PunchController attackController = (PunchController)attackObject.GetComponent(attackType);

        return(attackController);
    }
 protected override AttackController GetAttack()
 {
     if (levelManager.GetWarrior().IsWarriored(gameObject))
     {
         var             attackType       = new PunchController().GetType();
         string          attackName       = (isPowerOn) ? "SuperPunch" : "Punch";
         GameObject      attackObject     = (GameObject)Instantiate(Resources.Load(attackPrefabName + attackName));
         PunchController attackController = (PunchController)attackObject.GetComponent(attackType);
         return(attackController);
     }
     else
     {
         var                attackType       = new FireballController().GetType();
         string             attackName       = (isPowerOn) ? "SuperFireball" : "Fireball";
         GameObject         attackObject     = (GameObject)Instantiate(Resources.Load(attackPrefabName + attackName));
         FireballController attackController = (FireballController)attackObject.GetComponent(attackType);
         return(attackController);
     }
 }