本文整理汇总了C#中Fighter类的典型用法代码示例。如果您正苦于以下问题:C# Fighter类的具体用法?C# Fighter怎么用?C# Fighter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Fighter类属于命名空间,在下文中一共展示了Fighter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEndTurn
public override void OnEndTurn(Fighter fighter)
{
if (fighter.CurrentMP > 0)
{
this.ChallengeFailed(fighter);
}
}
示例2: sorcererStart
protected void sorcererStart(){
//important that this happens first, other initializations depend on it
fighter = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
//logically the sorcerer shouldn't be an enabled player unless it's the client in a game
playerEnabled = false;
if (Network.isClient) {
playerEnabled = true;
fighter.playerEnabled = false;
}
//inititalize skills before Player start
activeSkill1 = null;
activeSkill2 = null;
activeSkill3 = null;
activeSkill4 = null;
activeSkill5 = null;
activeSkill6 = null;
playerStart ();
initializePlayer();
initializeLevel();
initializePrimaryStats();
initializeSecondaryStatsBase();
initializeSecondaryStats();
calculateSecondaryStats();
health = maxHealth;
fighter.energy = fighter.maxEnergy;
target = null;
startPosition = transform.position;
//networking:
sorcererNetworkScript = (SorcererNetworkScript)gameObject.GetComponent<SorcererNetworkScript> ();
//database.readPrimaryStats();
}
示例3: Start
// Use this for initialization
void Start () {
subscribeToSorcererInstancePublisher (); // jump into game
fighter = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer (); // sorcerer = (Sorcerer) GameObject.FindObjectOfType (typeof (Sorcerer));
}
示例4: Start
// Use this for initialization
void Start () {
player = (Fighter) GameObject.FindObjectOfType (typeof (Fighter));
healthFrameWidth = (float)Screen.width*healthFrameWidthFix;
healthFrameHeight = (float)Screen.height*healthFrameHeightFix;
healthFillWidth = (float)Screen.width*healthFillWidthFix;
healthFillHeight =(float)Screen.height*healthFillHeightFix;
}
示例5: SetUp
public override void SetUp()
{
Params.Load("default.properties");
List<Entity> children = XNAGame.Instance.Children;
Ground ground = new Ground();
children.Add(ground);
XNAGame.Instance.Ground = ground;
Fighter fighter = new Fighter();
fighter.ModelName = "cobramk1";
fighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.arrive);
fighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.obstacle_avoidance);
fighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wall_avoidance);
fighter.Position = new Vector3(2, 20, -50);
fighter.TargetPos = fighter.Position * 2;
XNAGame.Instance.Leader = fighter;
children.Add(fighter);
Fighter fighter1 = new Fighter();
fighter1.ModelName = "viper";
fighter1.Target = fighter;
fighter1.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.pursuit);
fighter1.Position = new Vector3(-20, 20, -20);
children.Add(fighter1);
foreach (Entity child in children)
{
child.LoadContent();
}
}
示例6: AttackDetect
public void AttackDetect(Fighter plr)
{
//projectile checks
SPoint[] pHdr = new SPoint[8];
SPoint[] plBox;
plBox = plr.GetHitBox();
int hbLen=4;
float[] plAng ={0, Mathf.PI/2, Mathf.PI, -Mathf.PI/2};
bool hitflag = true;
for (int i=0; i<8; i++)
pHdr [i] = new SPoint (v [i].x + pos.x, v [i].y +pos.y);
float atkLen = GetVNum ();
for (int j = 0; j < atkLen; j++)
if (!CheckAxis (pHdr [0], ang [j], plBox, pHdr, hbLen, GetVNum ())) //no axis intersection
hitflag = false;
if (hitflag)//test on the axis of the player hit box to confirm
for (int j = 0; j < 4; j++)
if (!CheckAxis (plBox [j], plAng [j], plBox, pHdr, hbLen,GetVNum ())) //no axis intersection
hitflag = false;
if (hitflag) {
active = false;
plr.GetHit (hitdata);
Detonate ();
}
}
示例7: OnGotHit
void OnGotHit(Fighter attacker)
{
Alive attackersAlive = attacker.GetComponent<Alive>();
if (!charController.CommandIssued && !attackersAlive.IsDead) {
charController.Command_Attack( attackersAlive );
}
}
示例8: Fire
public virtual bool Fire(Fighter plr, SPoint o, SPoint v)
{
plNum = plr.plNum;
vel = new SPoint (velx*v.x, vely);
float diff;
if (!plr.fHelper.IsFacingRight()) {
diff = ((Mathf.PI / 2) - dir) * 2.0f;
dir += diff;
}
//dir 2.0fis the vector to travel in per second
//if(active)
// return false;
active=true;
pos=new SPoint(o.x,o.y+16);
transform.position = new Vector3 (pos.x, pos.y, 0);
ttl.SetTimer(2);
for (int i=0; i<ps.Length; i++) {
if (ps != null) {
ps[i].transform.position = new Vector3 (pos.x, pos.y, 0);
ps[i].enableEmission = true;
ps[i].Play ();
}
}
return true;
}
示例9: OnMove
public override void OnMove(Fighter fighter, int value)
{
if (value > 1)
{
this.ChallengeFailed(fighter);
}
}
示例10: DoSpawn
private IEnumerator DoSpawn(float delay, Action callback, Transform targetTransform)
{
yield return new WaitForSeconds(delay);
if (!_hasSpawned)
{
_fighterInst = Instantiate<Fighter>(FighterPrefab);
_fighterInst.SpawnVehicle(_fighterInst.gameObject, _fighterInst.VehiclePrefab, Universe.Current.GetUniversePosition(transform.position), transform.rotation);
if (targetTransform != null)
_fighterInst.SetTarget(targetTransform);
if (AddWarpEffect)
{
_warpEffect = _fighterInst.VehicleInstance.gameObject.AddComponent<WarpEffect>();
_warpEffect.transform.position = transform.position;
_warpEffect.transform.forward = transform.forward;
_warpEffect.WarpEffectPrefab = SpawnEffect;
_warpEffect.Timeout = 0.4f;
_warpEffect.Distance = 20f;
}
_hasSpawned = true;
if (callback != null)
callback();
if (OnSpawn != null)
OnSpawn(_fighterInst.gameObject);
}
}
示例11: Add
public static Player Add(Fighter player) {
if (Players == null) {
Players = new Fighter[4];
isFull = false;
numPlayers = 0;
}
for (int i = 0; i < Players.Length; i++) {
if (Players [i] == null) {
Players [i] = player;
numPlayers++;
UpdateContainer ();
switch (i) {
case 0:
Player1 = player;
return Player.Player1;
case 1:
Player2 = player;
return Player.Player2;
case 2:
Player3 = player;
return Player.Player3;
case 3:
Player4 = player;
return Player.Player4;
default:
Player1 = player;
return Player.Player1;
}
}
}
return Player.Null;
}
示例12: Execute
public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript)
{
fighterRef.GetComponent<Animator>().SetTrigger(_jumpHash);
Vector2 v = gameObject.GetComponent<Rigidbody2D>().velocity;
v.y = _jumpSpeed;
fighterRef.gameObject.GetComponent<Rigidbody2D>().velocity = v;
}
示例13: SetUp
public override void SetUp()
{
Params.Load("default.properties");
List<Entity> children = XNAGame.Instance.Children;
Fighter leader = new Fighter();
leader.Position = new Vector3(10, 120, 20);
leader.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wander);
leader.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.obstacle_avoidance);
leader.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wall_avoidance);
children.Add(leader);
Fighter camFighter = new Fighter();
camFighter.Leader = leader;
camFighter.Position = new Vector3(10, 120, 0);
camFighter.offset = new Vector3(0, 5, 10);
camFighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.offset_pursuit);
camFighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.wall_avoidance);
camFighter.SteeringBehaviours.turnOn(SteeringBehaviours.behaviour_type.obstacle_avoidance);
XNAGame.Instance.CamFighter = camFighter;
children.Add(camFighter);
Ground ground = new Ground();
children.Add(ground);
XNAGame.Instance.Ground = ground;
XNAGame.Instance.Camera.Position = new Vector3(10, 120, 50);
foreach (Entity child in children)
{
child.LoadContent();
}
}
示例14: BeginAttack
public virtual void BeginAttack(Damage damageToDeal, Fighter attacker)
{
weaponUser = attacker;
attackCast.OnHit += OnWeaponHit;
damageOut = damageToDeal;
attackCast.Begin ();
}
示例15: FixedUpdate
// Update is called once per frame
void FixedUpdate() {
if(mainCamera == null || fighter == null || sorcerer == null){
mainCamera = GameObject.FindGameObjectWithTag("MainCamera") as GameObject;;
fighter = GameObject.FindObjectOfType(typeof(Fighter))as Fighter;
sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer (); // sorcerer= GameObject.FindObjectOfType (typeof (Sorcerer))as Sorcerer;
}
else{
Player player = (fighter.playerEnabled)? (Player) fighter : sorcerer;
float distance = Vector3.Distance(mainCamera.transform.position,player.transform.position);
RaycastHit[] hits = Physics.RaycastAll (mainCamera.transform.position, player.transform.position, distance,checkLayers);
foreach (GameObject gO in invisibleList){
gO.layer = LayerMask.NameToLayer(visibleLayerName);
}
invisibleList = new List<GameObject>();
foreach(RaycastHit hit in hits){
if(Vector3.Distance (mainCamera.transform.position,hit.collider.gameObject.transform.position)<distance){
hit.collider.gameObject.layer = LayerMask.NameToLayer(invisibleLayerName);
invisibleList.Add(hit.collider.gameObject);
}
}
// foreach(GameObject gO in gameObjects){
// if (gO == this.gameObject){
// this.gameObject.layer = invisibleLayer.value;
// }
// else{
// this.gameObject.layer = visibleLayer.value;
// }
// }
}
}