void gunBeginDamage() { float randomAngle = UnityEngine.Random.value * 90; damageBeginDirection = Quaternion.AngleAxis(randomAngle, Vector3.forward) * minAngle; AnimationGunDamage = Ani_GunDamage; }
void mergeFunctions() { allFunPrepareToRun = null; for (int i = 0; i < All.Count; i++) { allFunPrepareToRun += All[i].function; } recordName(); }
public void addAction(FUN fun, Transform transform = null) //can add a function multi times { Action action = pool.create(); if (action == null) { Debug.Log("no more action in pool"); return; } action.init(fun, transform); action.indexInGroup = All.Count; All.Add(action); mergeFunctions(); }
////////////////// // Constructors // ////////////////// public CityPart(PLACE cityPlace, POPULATION population, Citizen.ECONOMIC_CLASS populationWealth, INDUSTRY industry, SECTOR_INVESTMENT industryInvestment, FUN fun, SECTOR_INVESTMENT leisureInvestment, INFRASTRUCTURE infrastructure, SECTOR_INVESTMENT transportInvestment, City city) { this.city = city; CityPlace = cityPlace; Citizens = new Dictionary <int, Citizen>(); nonAllocatedHomes = new List <Coords>(); cityHomesGrid = new int[32, 32]; GlobalHappiness = new RepresentativeIndex("Felicidad Global", "Felicidad Global en el barrio " + CityPlace, 0.5f); GlobalHealth = new RepresentativeIndex("Salud Global", "Salud Global en el barrio " + CityPlace, 0.5f); LowClassProportion = new RepresentativeIndex("Clase Baja", "Proporción de ciudadanos de clase baja en el barrio " + CityPlace, 0.5f); MiddleClassProportion = new RepresentativeIndex("Clase Media", "Proporción de ciudadanos de clase media en el barrio " + CityPlace, 0.5f); HighClassProportion = new RepresentativeIndex("Clase Alta", "Proporción de ciudadanos de clase alta en el barrio " + CityPlace, 0.5f); InitLaboralSector(industry, industryInvestment); InitTransportSector(infrastructure, transportInvestment); InitLeisureSector(fun, leisureInvestment); InitPopulation(population, populationWealth); // It has to be the last initialization //ProcessDay(); }
void Ani_GunDamage() { Vector3 finalFlyDirect = Vector3.Slerp(damageBeginDirection, Vector3.down, var); rotateCenter.Translate(finalFlyDirect * damageSpeed * MainLoop.lastFrameTime, Space.World); rotateCenter.Rotate(Vector3.forward, rotateSpeed * MainLoop.lastFrameTime, Space.World); var += (varSpeed * MainLoop.lastFrameTime); if (var >= 1) { var = 1; } damageTime -= MainLoop.lastFrameTime; if (damageTime <= 0) { AnimationGunDamage = null; gunRoot.transform.gameObject.SetActive(false); } }
public void removeAction(FUN fun, Transform transform = null) { removeFunName.Remove(0, removeFunName.Length); if (transform != null) { removeFunName.Append(transform.name.ToString() + "." + fun.Method.ToString()); } else { removeFunName.Append(fun.Target.ToString() + "." + fun.Method.ToString()); } Action action = All.Find(x => x.name.ToString().Equals(removeFunName.ToString())); if (action != null) { All.Remove(action); pool.delete(action); } mergeFunctions(); }
void InitLeisureSector(FUN fun, SECTOR_INVESTMENT investment) { float investmentValue = 0f, funValue = 0; switch (fun) { case FUN.BORING: funValue = 0.25f; break; case FUN.ENJOYABLE: funValue = 0.5f; break; case FUN.ENTERTAINING: funValue = 0.75f; break; } switch (investment) { case SECTOR_INVESTMENT.LOW: investmentValue = 0.25f; break; case SECTOR_INVESTMENT.MEDIUM: investmentValue = 0.5f; break; case SECTOR_INVESTMENT.HIGH: investmentValue = 0.75f; break; } LeisureSector = new LeisureSector(investmentValue, funValue, CityPlace); }
public bool DataTable2List ( ref DataTable dt ) { FUN Fun = new FUN () ; Items.Clear (); if ( !FldCol.IsValid () || SQL.IsNotValid ( ref dt ) ) return false; bool bRet = true; int ColMax = Columns.Count; string [ ] strsSubItem = new string [ ColMax ]; int LineNum = dt.Rows.Count; ListViewItem [ ] lis = new ListViewItem [ LineNum ]; Type t; DateTime dat; BeginUpdate (); SuspendLayout (); string strFld , strText; int i = 0 , j = 0; try { foreach ( DataRow dr in dt.Rows ) { j = 0; foreach ( ColumnHeader hd in Columns ) { strFld = FldCol.GetFldName ( hd.Text ); if ( strFld == String.Empty ) { strsSubItem [ j++ ] = ""; //不需要从dt中读入的col, 设置为空 } else { t = dr [ strFld ].GetType (); if ( t == typeof ( System.DateTime ) ) { dat = FF.Fun.MyConvert.Str2Date ( dr [ strFld ].ToString () ); if( dat.Year == 1900 ) //strsSubItem[j++] = String.Empty; //2013-10-09 怕引起其他错误,暂时不用 strsSubItem[j++] = dat.ToString( "yyyy-MM-dd HH:mm" ); //使用yyyy代替yy, 可避免1900-01-01 被改变成 00-01-01( 操作系统会当成 2000-01-01 ) else strsSubItem [ j++ ] = dat.ToString ( "yy-MM-dd HH:mm" ); } else if ( t == typeof ( System.Decimal ) ) //decimal 或者 Money类型 { strText = dr [strFld].ToString ().Trim (); strsSubItem [j++] = Fun.MyConvert.Decimal2StrDot4 ( strText ); //控制到2位小数点。 } else //其他类型的字段 都默认为文本方式。 { strText = dr [strFld].ToString ().Trim (); strsSubItem [j++] = strText; } } } lis [ i++ ] = new ListViewItem ( strsSubItem ); } Items.AddRange ( lis ); } catch ( Exception e ) { bRet = false; string strMsg = String.Format ( "DataTable2List() Err!\nTable:{0}\n{1}" , dt.TableName , e.Message ); FF.Ctrl.MsgBox.ShowWarn ( strMsg ); } ResumeLayout (); EndUpdate (); return bRet; }
public void reset() { function = null; name.Remove(0, name.Length); indexInGroup = -1; }
public void init(FUN fun, Transform objTrans) { function = fun; name.Append(objTrans.name.ToString() + "." + fun.Method.ToString()); }
public void init(FUN fun) { function = fun; name.Append(fun.Target.ToString() + "." + fun.Method.ToString()); }
public FrmInformation(Form1 f1) { InitializeComponent(); f = f1; fn = Init; }
void Init() { skinLabel2.Text = webBrowser1.Document.Title.Split('-')[0]; webBrowser1.Document.GetElementById("ctl00_ContentPlaceHolder1_LoginView1_Login1_UserName").SetAttribute("value", f.txtId.Text); fn = Proc; webBrowser1.Document.GetElementById("Button1").InvokeMember("click"); // }
void initFunDelegate() { AnimationGunDamage = Ani_GunDamage; }