private void ProjectTagInit(StreamReader stream) { string raw; while ((raw = stream.ReadLine().Trim()) != "}") { if (raw == "{") { continue; } switch (raw.Substring(0, raw.IndexOf('='))) { case "TYPE": if (raw.Substring(6).Trim('\"').Equals("fighter", StringComparison.InvariantCultureIgnoreCase)) { _type = ProjType.Fighter; } else if (raw.Substring(6).Trim('\"').Equals("weapon", StringComparison.InvariantCultureIgnoreCase)) { _type = ProjType.Weapon; } break; case "PARAM": _paramPath = raw.Substring(7).Trim('\"'); break; } } }
// Use this for initialization public void setProjType(ProjType p, Vector2 start, Vector2 rel_vel, Vector2 firevec, bool friendly, bool alt) { this.gameObject.layer = friendly ? 10 : 11; var rb = GetComponent <Rigidbody2D>(); this.transform.position = start; this.transform.eulerAngles = new Vector3(0, 0, Mathf.Rad2Deg * Mathf.Atan2(firevec.y, firevec.x)); float launchscale = 0; float rel_vel_bias = 0; switch (p) { case ProjType.ARROW: rb.gravityScale = 0.3f; launchscale = 5; firevec.y = 0.1f; rel_vel_bias = 1; if (alt) { firevec.y = 1f; launchscale = 3; } break; case ProjType.AXE: rb.gravityScale = 1f; launchscale = 3; rb.AddTorque(1); firevec.y = 0.3f; rel_vel_bias = 1f; if (alt) { firevec.y = 5f; } break; case ProjType.BULLET: rb.gravityScale = 0f; launchscale = 7; if (alt) { firevec.y = 1f; } break; } firevec = firevec.normalized; GetComponent <Rigidbody2D>().velocity = (rel_vel_bias * rel_vel) + (firevec * launchscale); GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("projectile/" + p.ToString()); var bx = gameObject.AddComponent <BoxCollider2D>(); bx.size = 0.01f * getWeaponDim(p); }
Projection FindProjection(ProjType type, CellestialPhysics obj, Vector3 axis) { // Finds min (ProjType.BEGIN) or max (ProjType.END) projection of // an object on the provided axis // -- mark the axis you're interested in with a 1 for that vector // component, leave all others on 0, i.e (0,1,0) checks the Y axis Projection proj = new Projection(); proj.body = obj; SpriteRenderer sr = obj.GetComponent <SpriteRenderer>(); float num; switch (type) { case ProjType.BEGIN: num = Vector3.Dot(axis, sr.bounds.min); proj.value = num; proj.type = ProjType.BEGIN; break; case ProjType.END: num = Vector3.Dot(axis, sr.bounds.max); proj.value = num; proj.type = ProjType.END; break; } return(proj); }
void GenerateProjectile(ProjType type) { for (int i = 0; i < CreateCount; i++) { projQueue[(int)type].Enqueue(CreateProjectile(type)); } }
//获取投影方式索引值 private int getProjNum(ProjType pt) { int projNum = 0; switch (pt) { case ProjType.Latlon: projNum = 1; break; case ProjType.Mercator: projNum = 2; break; case ProjType.Lambert: projNum = 3; break; case ProjType.Stereographic: projNum = 4; break; case ProjType.Albers: projNum = 5; break; } return(projNum); }
Projectile CreateProjectile(ProjType type) { Projectile newProj = Instantiate(projPrefabs[(int)type], this.transform); newProj.gameObject.SetActive(false); newProj.transform.position = Vector3.zero; return(newProj); }
public Vector2 getWeaponDim(ProjType p) { switch (p) { case ProjType.ARROW: return(new Vector2(5, 5)); case ProjType.AXE: return(new Vector2(15, 7)); case ProjType.BULLET: return(new Vector2(15, 7)); } return(Vector2.zero); }
public Projectile GetObject(ProjType type) { if (projQueue[(int)type].Count > 0) { Projectile arrow = projQueue[(int)type].Dequeue(); arrow.gameObject.SetActive(true); return(arrow); } else { Projectile newProj = CreateProjectile(type); newProj.gameObject.SetActive(true); return(newProj); } }
//sets currentEquip to passed in equipment type //called by oncollision method of weapon pickup after it grabs the equipment handler component of collided player if it collides with a player public void ChangeEquip(ProjType p) { //TODO: implement weapon change PlayerWeapon locWeapon=null; //just for assignment reasons if (p.Equals(ProjType.straight)) { locWeapon = Straight; } else if (p.Equals(ProjType.bounce)) { locWeapon = Bounce; } else if (p.Equals(ProjType.curve)) { locWeapon = Curve; } else if (p.Equals(ProjType.missile)) { locWeapon = Missle; } else if (p.Equals(ProjType.chain)) { locWeapon = Straight; } else if (p.Equals(ProjType.columbus)) { locWeapon = Columbus; } else if (p.Equals(ProjType.spread)) { locWeapon = Spread; } else if (p.Equals(ProjType.boomerang)) { locWeapon = Straight; } equippedWeapon = locWeapon; weaponObject = locWeapon.WeaponPrefab; curryAmmo = locWeapon.ammo; Utilities.SendToListeners(new Message(gameObject, OmonoPehaviour.ms_EQUIPCHANGE)); }
protected override void WhatIfAction() { TaskLogger.LogInfo(MessageImportance.High, "Projects will be categorized for Scope '{0}'", BuildScope.ToString()); TaskLogger.LogInfo(MessageImportance.High, "Project Type '{0}' will be used ", ProjType.ToString()); TaskLogger.LogInfo(MessageImportance.High, "Project Category '{0}' will be used ", ProjCat.ToString()); TaskLogger.LogInfo(MessageImportance.High, "Tokens to be included '{0}'", CmdLineIncludeScope); TaskLogger.LogInfo(MessageImportance.High, "Tokens to be excluded '{0}'", CmdLineExcludeScope); TaskLogger.LogInfo(MessageImportance.High, "Repository Root Dir Path '{0}'", RepositoryRootDirPath); ProjectSearchUtility psu = new ProjectSearchUtility(RepositoryRootDirPath, MultipleScopes, BuildScope, FullyQualifiedBuildScopeDirPath, CmdLineExcludeScope, CmdLineIncludeScope, ProjType, ProjCat); psu.UseLegacyDirs = UseLegacyDirStructure; TaskLogger.LogInfo(MessageImportance.High, "Use Legacy Directory Strucuture is set to '{0}'", psu.UseLegacyDirs.ToString()); TaskLogger.LogInfo(MessageImportance.High, "SDK Root Dir Path '{0}'", psu.SDKRootDir); TaskLogger.LogInfo(MessageImportance.High, psu.SearchDirPaths, "Search Dir Path(s)"); }
public Project(Model.BPProj proj, ProjType type) : this() { this.Guid = proj.Guid; this.Namespace = proj.Namespace; this.CommonRefList = new List<string>(); this.Type = type; if (this.Type == ProjType.Agent) { this.DllName = this.Namespace + ".Agent"; } if (this.Type == ProjType.Deploy) { this.DllName = this.Namespace + ".Deploy"; } foreach (Model.BPEntity entity in proj.EntityList) { if (this.Type != ProjType.Deploy) { if (this.Type == ProjType.Agent) { this.FileList.Add(entity.Code + "Agent"); } else { this.FileList.Add(entity.Code); } } } foreach (Model.EnumEntity enumEntity in proj.EnumList) { if (this.Type == ProjType.Deploy) { this.FileList.Add(enumEntity.Code + Net.Code.Builder.Build.Model.DTOEntity.AttrEndTag); } } if (this.Type == ProjType.Deploy) { foreach (Model.DTOEntity entity in proj.DTOList) { this.FileList.Add(entity.Code); } } this.CommonRefList.Add("NHExt.Runtime"); this.CommonRefList.Add("log4net"); if (this.Type == ProjType.BP) { this.CommonRefList.Add("NHibernate"); } foreach (Net.Code.Builder.Base.AbstractPlatformComponent refrence in proj.RefrenceList) { Model.ProjectRefrence pr = refrence as Model.ProjectRefrence; if (this.Type == ProjType.Deploy) { if (pr.RefrenceType == Net.Code.Builder.Enums.RefType.BEEntity) continue; if (pr.RefrenceType == Enums.RefType.Agent) continue; if (pr.RefrenceType == Enums.RefType.BPEntity) continue; if (pr.RefProjName == proj.FileName) { if (pr.RefrenceType == Net.Code.Builder.Enums.RefType.Deploy) continue; } } else if (this.Type == ProjType.Agent) { if (pr.RefrenceType != Net.Code.Builder.Enums.RefType.Deploy) continue; } this.RefrenceList.Add((refrence as Model.ProjectRefrence).AssemblyName); } if (this.Type == ProjType.Deploy) { this.DllName = this.Namespace + "." + Net.Code.Builder.Build.Model.DTOEntity.AssemblyEndTag; } else if (this.Type == ProjType.Agent) { this.DllName = this.Namespace + "." + Net.Code.Builder.Build.Model.BPEntity.AssemblyEndTag; } else { this.DllName = this.Namespace; } }
public Projection() { value = 0; body = null; type = ProjType.BEGIN; }
public Projection(float val, CellestialPhysics obj, ProjType t) { value = val; body = obj; type = t; }
public static void ReturnObject(Projectile Object, ProjType type) { Object.gameObject.SetActive(false); Object.transform.position = Vector3.zero; instance.projQueue[(int)type].Enqueue(Object); }
private void ProjectTagInit(StreamReader stream) { string raw; while ((raw = stream.ReadLine().Trim()) != "}") { if (raw == "{") continue; switch (raw.Substring(0, raw.IndexOf('='))) { case "TYPE": if (raw.Substring(6).Trim('\"').Equals("fighter", StringComparison.InvariantCultureIgnoreCase)) _type = ProjType.Fighter; else if (raw.Substring(6).Trim('\"').Equals("weapon", StringComparison.InvariantCultureIgnoreCase)) _type = ProjType.Weapon; break; case "PARAM": _paramPath = raw.Substring(7).Trim('\"'); break; } } }
//获取投影方式索引值 private int getProjNum(ProjType pt) { int projNum=0; switch(pt) { case ProjType.Latlon: projNum = 1; break; case ProjType.Mercator: projNum = 2; break; case ProjType.Lambert: projNum = 3; break; case ProjType.Stereographic: projNum = 4; break; case ProjType.Albers: projNum = 5; break; } return projNum; }