本文整理汇总了C#中Weapon类的典型用法代码示例。如果您正苦于以下问题:C# Weapon类的具体用法?C# Weapon怎么用?C# Weapon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Weapon类属于命名空间,在下文中一共展示了Weapon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ExecuteAddSupplementCommand
protected override void ExecuteAddSupplementCommand(string[] commandWords)
{
string supplementId = commandWords[1];
string id = commandWords[2];
var unitForAdding = this.GetUnit(id);
ISupplement supplement = null;
switch (supplementId)
{
case "AggressionCatalyst":
supplement = new AggressionCatalyst();
break;
case "Weapon":
supplement = new Weapon();
break;
case "PowerCatalyst":
supplement = new PowerCatalyst();
break;
case "HealthCatalyst":
supplement = new HealthCatalyst();
break;
default:
break;
}
unitForAdding.AddSupplement(supplement);
}
开发者ID:IskraNikolova,项目名称:Object-oriented-programming,代码行数:27,代码来源:ExtendingHoldingPen.cs
示例2: NewWeaponEquipped
void NewWeaponEquipped(Weapon.WeaponType weaponType)
{
//reset weapon animations
animator.Rebind();
//activate/deactivate specific animator layers when new weapons get equipped
if (weaponType == Weapon.WeaponType.Sword)
{
animator.SetLayerWeight(2, 1);
animator.SetLayerWeight(3, 0);
animator.SetLayerWeight(4, 0);
}
else if (weaponType == Weapon.WeaponType.Axe)
{
animator.SetLayerWeight(2, 0);
animator.SetLayerWeight(3, 1);
animator.SetLayerWeight(4, 0);
}
else if (weaponType == Weapon.WeaponType.Hammer)
{
animator.SetLayerWeight(2, 0);
animator.SetLayerWeight(3, 0);
animator.SetLayerWeight(4, 1);
}
}
开发者ID:BrodyMedia,项目名称:Unity2D-Components,代码行数:25,代码来源:AnimationHandler.cs
示例3: genItem
public static new Weapon genItem()
{
Weapon i = new Weapon();
i.itemID = ItemDatabase.GenerateID();
i.billboard = false;
return i;
}
开发者ID:Gornel,项目名称:Overworld,代码行数:7,代码来源:Weapon.cs
示例4: Awake
new void Awake()
{
base.Awake();
weapon = GetComponent<Weapon>();
MAX_HEALTH *= 10f;
health = MAX_HEALTH;
}
开发者ID:rainbee2214,项目名称:TMHTU2015,代码行数:7,代码来源:Player.cs
示例5: TakesHit
public void TakesHit(string weaponType, Weapon weapon, Collider2D coll, int hitFrom)
{
// calculate damage
player.HP -= (int)(weapon.damage * DIFFICULTY_DAMAGE_MODIFIER);
// produce effects
// params for ShakeCamera = duration, strength, vibrato, randomness
Messenger.Broadcast<float, float, int, float>("shake camera", .5f, .3f, 20, 5f);
Messenger.Broadcast<int>("reduce hp", player.HP);
// float xDistance = hitFrom == LEFT ? 2f : -2f;
// transform.DOJump(new Vector3(transform.position.x + xDistance, transform.position.y, transform.position.z), .2f, 1, .5f, false);
if (hitFrom == RIGHT)
{
BroadcastMessage("RepulseToLeft", 5.0F);
}
else
{
BroadcastMessage("RepulseToRight", 5.0F);
}
if (player.HP > 0)
{
MFX.FadeToColorAndBack(spriteRenderer, MCLR.bloodRed, 0f, .2f);
}
else
{
Messenger.Broadcast<string, Collider2D, int>("player dead", "projectile", coll, hitFrom);
}
}
开发者ID:hftamayo,项目名称:Unity2D-Components,代码行数:31,代码来源:PlayerManager.cs
示例6: Start
void Start()
{
_collider = GetComponent<Collider2D>();
_rigidbody = GetComponent<Rigidbody2D>();
weapon = GetComponentInChildren<Weapon>();
anim = GetComponent<Animator>();
SP = GetComponent<SpecialPower>();
distToGround = _collider.bounds.extents.y;
UpdateHealthSlider();
GameManager.instance.players.Add(this);
GameManager.instance.SetControls();
if (useSecondaryControls)
{
keys[0] = KeyCode.W;
keys[1] = KeyCode.Space;
keys[2] = KeyCode.D;
keys[3] = KeyCode.A;
keys[4] = KeyCode.LeftShift;
facingRight = true;
}
else
{
keys[0] = KeyCode.UpArrow;
keys[1] = KeyCode.Return;
keys[2] = KeyCode.RightArrow;
keys[3] = KeyCode.LeftArrow;
keys[4] = KeyCode.RightShift;
transform.localScale = new Vector3(-1, 1, 1);
facingRight = false;
}
}
开发者ID:GlitchBoss,项目名称:TextWars,代码行数:31,代码来源:Player.cs
示例7: SpawnMuzzleFlare
private void SpawnMuzzleFlare(Weapon weapon)
{
var flare = ObjectPool.Instance.GetObject(MuzzleFlare);
flare.transform.position = weapon.Emitter.position;
flare.transform.rotation = weapon.Emitter.rotation;
flare.transform.parent = weapon.Emitter;
}
开发者ID:steve-salmond,项目名称:LD33,代码行数:7,代码来源:ProjectileAttack.cs
示例8: Morph
public static Weapon Morph(Weapon mine, Weapon other)
{
Weapon combined = new Weapon();
float targetStrength = Mathf.Max(mine.GetStrength(), other.GetStrength()) + MORPH_STRENGTH_INCREASE;
float strength = 0;
foreach (BulletSpawner bs in mine.bulletSpawners) {
if (UnityEngine.Random.value < CHANCE_TO_KEEP_WEAPON) {
strength += bs.GetStrength(combined);
combined.bulletSpawners.Add(bs);
}
}
foreach (BulletSpawner bs in other.bulletSpawners) {
if (UnityEngine.Random.value < CHANCE_TO_GAIN_WEAPON) {
strength += bs.GetStrength(combined);
combined.bulletSpawners.Add(bs);
}
}
while (strength < targetStrength) {
BulletSpawner bulletSpawner = BulletSpawner.Random();
strength += bulletSpawner.GetStrength(combined);
combined.bulletSpawners.Add(bulletSpawner);
}
return combined;
}
开发者ID:wez470,项目名称:GameJam2,代码行数:29,代码来源:Weapon.cs
示例9: Start
void Start()
{
player_controller_ = GetComponent<PlayerController>();
var weapon_attacher = GetComponent<WeaponAttacher>();
right_weapon_ = weapon_attacher.getRightWeapon;
left_weapon_ = weapon_attacher.getLeftWeapon;
}
开发者ID:ooHIROoo,项目名称:BuildFighters,代码行数:7,代码来源:PlayerAttacker.cs
示例10: Main
static void Main(string[] args)
{
Console.WriteLine("Hello");
Weapon stick = new Weapon("Stick", 1, WeaponType.Blunt, 2);
CharacterBase player = Player.GetInstance();
Console.WriteLine(player);
player.EquipWeapon(stick);
Console.WriteLine(player);
Console.WriteLine("Player MaxHealth : " + player.MaxHealth);
Console.WriteLine("Adding +10 health buff to player");
BaseEffect effect = new MaxHealthAdditionEffect(10);
player.EffectsManager.AddEffect(effect);
Console.WriteLine("Player MaxHealth : " + player.MaxHealth);
Console.WriteLine("Removing +10 health buff from player");
player.EffectsManager.RemoveEffect(effect);
Console.WriteLine("Player MaxHealth : " + player.MaxHealth);
Console.WriteLine("Press Enter to Exit");
Console.ReadKey();
}
开发者ID:Kornetzke,项目名称:ConceptTests,代码行数:28,代码来源:Program.cs
示例11: AddWeapon
public void AddWeapon(string key, Weapon weapon)
{
if (!GetWeapons().ContainsKey(key))
{
_weapons.Add(key, weapon);
}
}
开发者ID:djastin,项目名称:XNA2DGame,代码行数:7,代码来源:FeatureLoader.cs
示例12: Start
// Use this for initialization
void Start () {
Inventory = new List<Item>();
if (GodMode)
{
Weapon w = new Weapon(WeaponType.Rifle);
Inventory.Add(w);
}
//set active (for now)
activeItem = Inventory[0];
Facing = FacingDirection.Left;
Animation = AnimateState.Down;
PlayerCamera = Camera.main;
TargetPosition = transform.position;
PlayerConvText = GameObject.Find("PlayerConvText");
textures = new Texture[4];
textures[0] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_back.png", typeof(Texture));
textures[1] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_front.png", typeof(Texture));
textures[2] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_left.png", typeof(Texture));
textures[3] = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Characters\\theblind_right.png", typeof(Texture));
GetComponent<Renderer>().material.mainTexture = textures[2];
}
开发者ID:miintz,项目名称:ParadigmShift,代码行数:31,代码来源:Player.cs
示例13: Start
void Start()
{
projectile = GetComponent<ProjectileManager>();
weapon = GetComponentInChildren<Weapon>();
target = GameObject.Find(PLAYER).transform;
attackInterval = Rand.Range(1.5f, 2.5f);
}
开发者ID:BrodyMedia,项目名称:Unity2D-Components,代码行数:7,代码来源:AttackAI.cs
示例14: Awake
protected virtual void Awake()
{
if(Weapon == null)
{
Weapon = GetComponent<Weapon>() ?? GetComponentInParent<Weapon>();
}
}
开发者ID:Snakybo-School,项目名称:OUTGEFOUND,代码行数:7,代码来源:WeaponComponent.cs
示例15: DetermineCombatLevel
/// <summary>
/// Determines the level.
/// </summary>
/// <param name="skills">The skills.</param>
/// <param name="weapon">The weapon.</param>
public static int DetermineCombatLevel(SkillsContainer skills, Weapon weapon)
{
double a = skills.Attack + weapon.APoints;
double d = skills.Defense / skills.Handicap;
return Convert.ToInt32(Math.Ceiling(a + d));
}
开发者ID:philippdolder,项目名称:CleanCode.Academy,代码行数:12,代码来源:LevelCalculationHelper.cs
示例16: UnitEquipment
public UnitEquipment( Weapon weaponPrimary, Weapon weaponSecondary, Equippable[] misc, Biomod biomod = null )
{
this.weaponPrimary = weaponPrimary;
this.weaponSecondary = weaponSecondary;
this.misc = misc;
this.biomod = biomod;
}
开发者ID:choephix,项目名称:G11,代码行数:7,代码来源:Unit+ExtraClasses.cs
示例17: Init
// note: ProjectileContainers contain simple dummy values, which are
// then replaced by data that's passed-in via projectile objects
void Init(Weapon incoming)
{
weapon = incoming;
weaponType = incoming.weaponType;
alreadyCollided = false;
iconSprite = incoming.iconSprite;
title = incoming.title;
damage = incoming.damage;
hp = incoming.hp;
rateOfAttack = incoming.rateOfAttack;
spriteRenderer.sprite = incoming.carriedSprite;
speed = incoming.speed;
maxDistance = incoming.maxDistance;
lob = incoming.lob;
lobGravity = incoming.lobGravity;
fadeIn = incoming.fadeIn;
collider2D.enabled = true;
origin = new Vector3(transform.position.x, transform.position.y, transform.position.z);
// initialize animation controller if projectile is animated
if (incoming.GetComponent<Weapon>().animatedProjectile)
{
anim = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate
(Resources.Load(("Sprites/Projectiles/" + incoming.name + "_0"), typeof(RuntimeAnimatorController)));
animator.runtimeAnimatorController = anim;
animator.speed = .5f;
}
InvokeRepeating("CheckDistanceTraveled", 1, 0.3F);
}
开发者ID:BrodyMedia,项目名称:Unity2D-Components,代码行数:32,代码来源:ProjectileContainer.cs
示例18: Start
// Use this for initialization
void Start()
{
texture = new Texture2D(128, 128,TextureFormat.RGB24,false);
style = new GUIStyle();
texture2 = new Texture2D(128, 128,TextureFormat.RGB24,false);
style = new GUIStyle();
weapon = GetComponent<Weapon>();
ship = GetComponent<Ship>();
maxHealth = ship.GetHealth();
curHealth = maxHealth;
maxCool = weapon.GetcdTime();
curCool = maxCool;
for (int y = 0; y < texture.height; ++y)
{
for (int x = 0; x < texture.width; ++x)
{
Color color = new Color(238, 0, 238);
texture.SetPixel(x, y, color);
}
}
texture.Apply();
for (int y = 0; y < texture2.height; ++y)
{
for (int x = 0; x < texture2.width; ++x)
{
Color color = new Color(255, 0, 0);
texture2.SetPixel(x, y, color);
}
}
texture2.Apply();
}
开发者ID:emmaconner,项目名称:CS361-CMYKrash,代码行数:35,代码来源:MagentaShipGUI.cs
示例19: Awake
private void Awake()
{
m_hWeapon = this.GetComponent<Weapon>();
Owner = GetComponent<Actor>();
m_hIdle = new StateIdle(this);
m_hPatrol = new StatePatrol(this);
switch ((int)AimMode)
{
case 1:
m_hPatrol.Next = new StateAimBallistic(this);
break;
case 2:
m_hPatrol.Next = new StateAimDirect(this);
break;
}
m_hPatrol.Next.Next = m_hPatrol;
m_hCurrent = m_hPatrol;
m_hCurrent.OnStateEnter();
}
开发者ID:Alx666,项目名称:ProjectPhoenix,代码行数:25,代码来源:ControllerAITurret.cs
示例20: setStance
void setStance(BaseStance toSet)
{
currStance = toSet;
stanceText.color = currStance.colour;
stanceText.text = currStance.text;
weapon = ((Weapon)GetComponentInChildren (currStance.weapon));
}
开发者ID:Multihuntr,项目名称:random-game,代码行数:7,代码来源:Stance.cs
注:本文中的Weapon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论