コード例 #1
0
    public void Attack(GameObject target)
    {
        Debug.Log("atk");
        BaseAttribute attack = entityData.GetAttribute <AttackAttr>();

        if (attack == null)
        {
            Debug.Log("null"); return;
        }

        //do something to attack
        //target.GetComponent<ITarget>().GotHit(attack.Value);

        //initial value was 100 points
        // attack of 30
        //so we add -30 points to our defense
        DefenseAttr attr = new DefenseAttr(
            -attack.Value,
            0,
            100,
            0,
            GameEnums.Modifier.ADDITION);

        Modifier m = new Modifier(1, GameEnums.Modifier.ADDITION, attr);

        entityData.AddModifier(m);
    }