当前位置: 首页>>代码示例>>C#>>正文


C# Effect.GetMaterialPath方法代码示例

本文整理汇总了C#中Effect.GetMaterialPath方法的典型用法代码示例。如果您正苦于以下问题:C# Effect.GetMaterialPath方法的具体用法?C# Effect.GetMaterialPath怎么用?C# Effect.GetMaterialPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Effect的用法示例。


在下文中一共展示了Effect.GetMaterialPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AttachTurnEffect

 /**
  * Attach a single turn effect to this player
  *
  * Arguments
  * - TurnEffect toAdd - Effect to add
  */
 public void AttachTurnEffect(Effect toAdd)
 {
     switch (toAdd.GetTurnEffectType()) { // Apply turn effects immediately if needed
     case TurnEffectType.STATEFFECT: goto default; // Only apply stat effects in the next turn
     case TurnEffectType.MATERIALEFFECT:
         GetComponent<PhotonView>().RPC("SetNewMaterial", PhotonTargets.All,
                 new object[] {
                     toAdd.GetMaterialPath()
                 }
         );
         break;
     case TurnEffectType.ITEMEFFECT: // Apply item effects immediately
         foreach (Item item in inventory) {
             if (item != null)
                 toAdd.ApplyEffectToItem(item);
         }
         break;
     case TurnEffectType.MODELCHANGEEFFECT: goto case TurnEffectType.COMPONENTEFFECT;// Need complex attach routine
     case TurnEffectType.COMPONENTEFFECT: // Need a complex attach routine
         toAdd.ExtraAttachActions();
         break;
     default: break; // Don't do anything
     }
     turnEffects.Add(toAdd);
     effectPanelScript.AddTurnEffect(toAdd);
 }
开发者ID:RandomTroll18,项目名称:deco3801-nodayoff,代码行数:32,代码来源:Player.cs

示例2: applyTurnEffect

    /**
     * Apply a given turn effect
     *
     * Arguments
     * - TurnEffect effect - The turn effect to apply
     */
    void applyTurnEffect(Effect effect)
    {
        Stat stat; // The stat to effect
        int mode; // The mode of this turn effect

        if (effect.TurnsRemaining() == 0) { // Remove turn effect
            DetachTurnEffect(effect);
            return;
        }

        if (effect.IsAppliedPerTurn()) { // Apply per turn
            switch (effect.GetTurnEffectType()) {
            case TurnEffectType.STATMULTIPLIEREFFECT: // Stat multiplier effect
                stat = effect.GetStatAffected();
                mode = effect.GetMode();
                Debug.LogWarning("Stat affected: " + EnumsToString.ConvertStatEnum(stat));
                Debug.LogWarning("Previous value: " + playerClass.GetStat(stat));
                switch (mode) {
                case 0: // Increment
                    playerClass.IncreaseStatMultiplierValue(stat, effect.GetValue());
                    break;
                case 1: // Set stat
                    playerClass.SetMultiplierStat(stat, effect.GetValue());
                    break;
                case 2: // Decrement
                    playerClass.DecreaseStatMultiplierValue(stat, effect.GetValue());
                    break;
                default:
                    throw new System.NotSupportedException("Invalid mode");
                }
                Debug.LogWarning("Current value: " + playerClass.GetStat(stat));
                break;
            case TurnEffectType.STATEFFECT: // Stat effect
                stat = effect.GetStatAffected();
                mode = effect.GetMode();
                Debug.LogWarning("Stat affected: " + EnumsToString.ConvertStatEnum(stat));
                Debug.LogWarning("Previous value: " + stats[stat]);
                switch (mode) {
                case 0: // Increment to stat
                    IncreaseStatValue(stat, effect.GetValue());
                    break;
                case 1: // Set stat
                    SetStatValue(stat, effect.GetValue());
                    break;
                case 2: // Multiply stat
                    SetStatValue(stat, stats[stat] * effect.GetValue());
                    break;
                default: // Invalid mode. Do nothing
                    throw new System.NotSupportedException("Invalid mode");
                }
                Debug.LogWarning("Current value: " + stats[stat]);
                break;
            case TurnEffectType.MATERIALEFFECT:
                // Only replace material if not already set
                if (!PlayerObject.GetComponentInChildren<Renderer>().material.Equals(effect.GetMaterial())) {
                    GetComponent<PhotonView>().RPC("SetNewMaterial", PhotonTargets.All,
                            new object[] {
                                effect.GetMaterialPath()
                            }
                    );
                }
                break;// Change material
            case TurnEffectType.COMPONENTEFFECT: // Component effect. Handled by component
                break;
            default: break; // Unknown
            }
        }

        effect.ReduceTurnsRemaining();
    }
开发者ID:RandomTroll18,项目名称:deco3801-nodayoff,代码行数:76,代码来源:Player.cs


注:本文中的Effect.GetMaterialPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。