Пример #1
0
    public void getAttacked(int rawDamage)
    {
        int dmg        = rawDamage - armor;
        int blockValue = 0;

        if (activeBlock != null)
        {
            blockValue = activeBlock.blockValue;
        }
        dmg        -= blockValue;
        dmg         = Mathf.Max(0, dmg);
        health     -= dmg;
        activeBlock = null;
        refreshUI();
        FloatingDamageTextController.Instance().createFloatingDamageText(transform, rawDamage, armor, blockValue, dmg);

        if (health <= 0)
        {
            if (playerCharacter)
            {
                GameAlertUI.Instance().setText("You died!");
            }
            else
            {
                TurnMaster.Instance().handleEnemyDeath(this);
                Destroy(gameObject);
            }
        }
    }
Пример #2
0
 /// <summary>
 /// This function is called when the object becomes enabled and active.
 /// </summary>
 void OnEnable()
 {
     FloatingDamageTextController.Initialize();
     GameControl.Control.CurrentLevel = SceneManager.GetActiveScene().buildIndex;
     currentLevelData     = GameControl.Control.GetLevelData();
     CompleteText.enabled = false;
 }
Пример #3
0
    public void resolveTargeting(Targetable target)
    {
        this.target = target;
        GameAlertUI.Instance().deactivateText();
        if (targetCategory == TargetCategory.Enemy)
        {
            CombatCharacter targetCharacter = target as CombatCharacter;

            //Debug.Log("Resolve Targeting");
            if ((!undodgeable) && targetCharacter.checkDodge(details.character))
            {
                FloatingDamageTextController.Instance().createDodgeText(targetCharacter.transform);
                this.target = null;
            }
            else
            {
                //Debug.Log("Not dodged");
            }
        }

        if (targetOnResolution)
        {
            abilityResolve = true;
            activateTargetAbility();
        }
        else
        {
            precastResolve = true;
        }
    }
Пример #4
0
 public static FloatingDamageTextController Instance()
 {
     if (!floatingDamageTextController)
     {
         floatingDamageTextController = FindObjectOfType <FloatingDamageTextController>();
     }
     return(floatingDamageTextController);
 }
Пример #5
0
 /// <summary>
 /// OnCollisionEnter is called when this collider/rigidbody has begun
 /// touching another rigidbody/collider.
 /// </summary>
 /// <param name="other">The Collision data associated with this collision.</param>
 void OnCollisionEnter(Collision other)
 {
     if (other.transform.tag != "Touchable")
     {
         FindObjectOfType <AudioManager>().Play("Crash");
         FloatingDamageTextController.CreateDamageText("-" + CrashDamage.ToString());
         AddCrash(CrashDamage);
     }
 }
Пример #6
0
    public void resolveTargeting(List <Targetable> targets)
    {
        this.targets   = targets;
        precastResolve = true;
        GameAlertUI.Instance().deactivateText();
        if (targetCategory == TargetCategory.Enemy)
        {
            for (int i = targets.Count - 1; i >= 0; i--)
            {
                CombatCharacter targetCharacter = this.targets[i] as CombatCharacter;

                //Debug.Log("Resolve Targeting");
                if ((!undodgeable) && targetCharacter.checkDodge(details.character))
                {
                    FloatingDamageTextController.Instance().createDodgeText(targetCharacter.transform);
                    this.targets.RemoveAt(i);
                }
                else
                {
                    //Debug.Log("Not dodged");
                }
            }
        }
    }