int htm = 1; // 差し引かれるHP値 void Start() { // Instantiateコンポーネントを取得 instantiate = GetComponent <Instantiate>(); Perfect = false; Good = false; Bad = false; Out = false; Heal = false; }
private void Awake() { if (Object.op_Equality((Object)this.prefabSource, (Object)null) || Object.op_Inequality((Object)this.createdGameObject, (Object)null)) { return; } this.createdGameObject = Instantiate.GameObject(this.prefabSource, (Transform)null); ((Object)this.createdGameObject).set_name(((Object)this.prefabSource).get_name()); this.createdGameObject.get_transform().SetParent(((Component)this).get_transform(), false); this.createdGameObject.Identity(); }
void Start() { theRigidbody2DProjectile = GetComponent <Rigidbody2D>(); theSpringJoint2D = GetComponent <SpringJoint2D>(); theSpriteRenderer = GetComponent <SpriteRenderer>(); theGameManager = GameObject.FindGameObjectWithTag("GM"); theInstantiateScript = theGameManager.GetComponent <Instantiate>(); theReloadScript = theGameManager.GetComponent <Reload>(); theSpringJoint2D.frequency = 5f; }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) { instantiateFigure = null; if (serializeDialog.ShowDialog() == DialogResult.Cancel) { return; } using (StreamWriter streamWriter = new StreamWriter(serializeDialog.FileName, false)) { foreach (var figure in Storage.AllFigures) { streamWriter.WriteLine(figure.Serialize()); } } }
private void Awake() { if (this.prefabSource == null) { return; } if (this.createdGameObject != null) { return; } this.createdGameObject = Instantiate.GameObject(this.prefabSource, null); this.createdGameObject.name = this.prefabSource.name; this.createdGameObject.transform.SetParent(base.transform, false); this.createdGameObject.Identity(); }
/// <inheritdoc/> public IEnumerable <IComposable> LoadModule(IModule module) { var logger = new LogProvider().GetLogger("AssemblyComposer"); // Unknown if logging service is available. logger.Info($"Loading module {module.Entry}"); try { var deps = module.ModuleDirectory.EnumerateDirectories().First(d => d.Name == "contents"); } catch (InvalidOperationException ex) { throw new DirectoryNotFoundException($"Unable to find module contents for {module.Entry}", ex); } var loadContext = new AssemblyModuleLoadContext(module); // todo: check for semver!! var entryPath = Path.Combine(module.ModuleDirectory.FullName, "contents", module.Entry); if (!File.Exists(entryPath)) { throw new FileNotFoundException($"Unable to find specified entry point {module.Entry}"); } var assembly = loadContext.LoadFromAssemblyPath(entryPath); IEnumerable <Type> types; try { types = assembly.ExportedTypes .Where(t => t.GetInterfaces().Contains(typeof(IComposable))) .Where(t => t.GetConstructor(Type.EmptyTypes) != null); } catch (TypeLoadException ex) { throw new TypeLoadException( $"Unable to load {module.Entry}, are you sure it is compatible with this version of Snowflake?", ex); } foreach (var type in types) { var container = Instantiate.CreateInstance(type); var castedContainer = (IComposable)container; Console.WriteLine($"Found Container {container.GetType().Name}"); yield return(castedContainer); } }
internal ConfigurationCollection(IConfigurationValueCollection defaults) { this.Descriptor = ConfigurationDescriptorCache.GetCollectionDescriptor <T>(); var genInstance = typeof(T).GetCustomAttribute <ConfigurationGenerationInstanceAttribute>(); if (genInstance == null) { throw new InvalidOperationException("Not generated!"); // todo: mark with interface to fail at compile time. } this.ValueCollection = defaults; this.Configuration = (T)Instantiate.CreateInstance(genInstance.InstanceType, new[] { typeof(IConfigurationValueCollection) }, Expression.Constant(this.ValueCollection)); }
BaseCombatEntity SpawnAttacker(string prefab, Vector3 position) { GameObject gameObject = Instantiate.GameObject(GameManager.server.FindPrefab(prefab), position, new Quaternion()); gameObject.name = prefab; SceneManager.MoveGameObjectToScene(gameObject, Rust.Server.EntityScene); UnityEngine.Object.Destroy(gameObject.GetComponent <Spawnable>()); if (!gameObject.activeSelf) { gameObject.SetActive(true); } return(gameObject.GetComponent <BaseCombatEntity>()); }
public void Process(string name, GameObject go) { if (go.CompareTag("NoPreProcessing")) { return; } GameObject hierarchyGroup = this.GetHierarchyGroup(); GameObject gameObject = go; go = Instantiate.GameObject(gameObject, hierarchyGroup.transform); go.name = gameObject.name; if (this.NeedsProcessing(go)) { this.ProcessObject(name, go, true); } this.AddPrefab(name, go); }
public void Rebuild() { this.options = ((IEnumerable <PieMenu.MenuOption>) this.options).OrderBy <PieMenu.MenuOption, int>((Func <PieMenu.MenuOption, int>)(x => x.order)).ToArray <PieMenu.MenuOption>(); while (this.optionsCanvas.get_transform().get_childCount() > 0) { GameManager.DestroyImmediate(((Component)this.optionsCanvas.get_transform().GetChild(0)).get_gameObject(), true); } float sliceSize = this.radiusSize / (float)this.options.Length; for (int index = 0; index < this.options.Length; ++index) { GameObject gameObject = Instantiate.GameObject(this.pieOptionPrefab, (Transform)null); gameObject.get_transform().SetParent(this.optionsCanvas.get_transform(), false); this.options[index].option = (PieOption)gameObject.GetComponent <PieOption>(); this.options[index].option.UpdateOption((float)((double)this.startRadius + (double)index * (double)sliceSize - (double)sliceSize * 0.25), sliceSize, this.sliceGaps, this.options[index].name, this.outerSize, this.innerSize, this.iconSize, this.options[index].sprite); } this.selectedOption = (PieMenu.MenuOption)null; }
void Start() { theRigidbody2DProjectile = GetComponent <Rigidbody2D>(); theSpringJoint2D = GetComponent <SpringJoint2D>(); theSpriteRenderer = GetComponent <SpriteRenderer>(); theGameManager = GameObject.FindGameObjectWithTag("GM"); theAnimationObject = GameObject.Find("PB"); theInstantiateScript = theGameManager.GetComponent <Instantiate>(); theReloadScript = theGameManager.GetComponent <Reload>(); theReloadMechanicScript = theGameManager.GetComponent <ReloadMechanic>(); theColorCheckingScript = GetComponent <ColorChecking>(); theAnimationHandlerScript = theAnimationObject.GetComponent <AnimationHandler>(); theSpringJoint2D.frequency = 5f; /*CheckColor();*/ }
private BaseEntity InstantiateEntity(string type, Vector3 position) { var gameObject = Instantiate.GameObject(GameManager.server.FindPrefab(type), position, new Quaternion()); gameObject.name = type; SceneManager.MoveGameObjectToScene(gameObject, Rust.Server.EntityScene); UnityEngine.Object.Destroy(gameObject.GetComponent <Spawnable>()); if (!gameObject.activeSelf) { gameObject.SetActive(true); } BaseEntity component = gameObject.GetComponent <BaseEntity>(); return(component); }
internal CollectionInterceptor(IConfigurationValueCollection defaults) { this.Values = new Dictionary <string, dynamic>(); foreach (var(type, name) in from props in typeof(T).GetPublicProperties() where props.GetIndexParameters().Length == 0 && props.PropertyType.GetInterfaces().Contains(typeof(IConfigurationSection)) select(type: props.PropertyType, name: props.Name)) { var sectionType = typeof(ConfigurationSection <>).MakeGenericType(type); if (name != null) { this.Values.Add(name, Instantiate.CreateInstance(sectionType, new Type[] { typeof(IConfigurationValueCollection), typeof(string) }, Expression.Constant(defaults), Expression.Constant(name))); } } }
public InputConfiguration(IControllerElementMappingProfile mappedElements, int playerIndex = 0) { this.PlayerIndex = playerIndex; this.Descriptor = ConfigurationDescriptorCache.GetSectionDescriptor <T>(typeof(T).Name); this.Options = (from prop in typeof(T).GetProperties() let inputOptionAttribute = prop.GetCustomAttribute <InputOptionAttribute>() where inputOptionAttribute != null let name = prop.Name select(name, option: (IInputOption) new InputOption(inputOptionAttribute, name))) .ToDictionary(o => o.name, o => o.option); var overrides = (from element in mappedElements from key in this.Options.Keys let option = this.Options[key] let target = option.TargetElement where element.LayoutElement == target where FlagEnums.HasAnyFlags(option.OptionType, element.DeviceCapability.GetClass()) select(key, element.DeviceCapability)).ToDictionary(d => d.key, d => d.DeviceCapability); var map = from key in this.Options.Keys let value = overrides.ContainsKey(key) ? overrides[key] : DeviceCapability.None select new KeyValuePair <string, DeviceCapability>(key, value); this.ValueCollection = new ConfigurationValueCollection(); var genInstance = typeof(T).GetCustomAttribute <ConfigurationGenerationInstanceAttribute>(); if (genInstance == null) { throw new InvalidOperationException("Not generated!"); // todo: mark with interface to fail at compile time. } this.Configuration = (T)Instantiate.CreateInstance(genInstance.InstanceType, new[] { typeof(IConfigurationSectionDescriptor), typeof(IConfigurationValueCollection), typeof(Dictionary <string, DeviceCapability>) }, Expression.Constant(this.Descriptor), Expression.Constant(this.ValueCollection), Expression.Constant(map.ToDictionary(m => m.Key, m => m.Value))); this.ConfigurationSection = new ConfigurationSection <T>(this.ValueCollection, this.Descriptor, this.Configuration); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { instantiateFigure = null; if (deserializeDialog.ShowDialog() == DialogResult.Cancel) { return; } Storage.Clear(); using (StreamReader streamReader = new StreamReader(deserializeDialog.FileName)) { bool warning = false; string line; while ((line = streamReader.ReadLine()) != null) { string[] temp = line.Split(','); Type figureType = Type.GetType(temp[0], false); figureType = figureType ?? exportedTypes.Find(t => t.FullName == temp[0]); if (figureType == null) { warning = true; } else { Figure figure = figureType.GetConstructor(new Type[0]).Invoke(new Object[0]) as Figure; figure.Deserialize(temp); figure.Canvas = FiguresProperties.Canvas; Storage.AllFigures.Add(figure); } } if (warning) { MessageBox.Show("Unknown figure found", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } DrawingUtils.Redraw(); }
public ObjectPool(Instantiate instantiate) { this.instantiate = instantiate; pool = new List <GameObject>(); }
public object Revert(object surrogate) => Instantiate.Invoke(surrogate, Array.Empty <object>());
/// <summary> /// 构造方法 /// </summary> /// <param name="instantiate">实例化委托</param> public ObjectPool(Instantiate instantiate) { this.instantiate = instantiate; pool = new List <ILazy>(); }
public static T Instantiate <T>(this T component) where T : Component { return(Instantiate.GameObject(component.gameObject, null).GetComponent <T>()); }
public static T Instantiate <T>(this T component) where T : Component { return(Instantiate.GameObject(((Component)(object)component).get_gameObject(), (Transform)null).GetComponent <T>()); }
private void Ellipse_Click(object sender, EventArgs e) { IFigureFactory factory = new EllipseFactory(); instantiateFigure = () => factory.Instantiate(); }
private void ManualPolygon_Click(object sender, EventArgs e) { IFigureFactory factory = new PolygonFactory(); instantiateFigure = () => factory.Instantiate(); }
private void PolyLine_Click(object sender, EventArgs e) { IFigureFactory factory = new PolyLineFactory(); instantiateFigure = () => factory.Instantiate(); }
private void redo_Click(object sender, EventArgs e) { instantiateFigure = null; Storage.Redo(); DrawingUtils.Redraw(); }
public GameObject Instantiate(Transform parent = null) { return(Instantiate.GameObject(this.Get(), parent)); }
public static void Compile(ByteCodeCompiler bcc, ParserContext parser, ByteBuffer buffer, Instantiate instantiate, bool outputUsed) { ClassDefinition cd = instantiate.Class; ConstructorDefinition constructor = cd.Constructor; bcc.CompileExpressionList(parser, buffer, instantiate.Args, true); buffer.Add(instantiate.NameToken, OpCode.CALL_FUNCTION, (int)FunctionInvocationType.CONSTRUCTOR, instantiate.Args.Length, constructor.FunctionID, outputUsed ? 1 : 0, cd.ClassID); }
public Node <INode> GetNode(string nodeName) { switch (nodeName) { case DeltaTime.NAME: INode nodeDeltaTime = new DeltaTime() as INode; return(new Node <INode> (nodeDeltaTime)); case KeyDown.NAME: INode nodeKeyDown = new KeyDown() as INode; return(new Node <INode> (nodeKeyDown)); case Transform.NAME: INode nodeTransform = new Transform() as INode; return(new Node <INode> (nodeTransform)); case Vec3.NAME: INode nodeVec3 = new Vec3() as INode; return(new Node <INode> (nodeVec3)); case Key.NAME: INode nodeKey = new Key() as INode; return(new Node <INode> (nodeKey)); case FindByName.NAME: INode nodeFindByName = new FindByName() as INode; return(new Node <INode> (nodeFindByName)); case ObjectAttribute.NAME: INode nodeObjectAttribute = new ObjectAttribute() as INode; return(new Node <INode> (nodeObjectAttribute)); case SplitVec3.NAME: INode nodeSplitVec3 = new SplitVec3() as INode; return(new Node <INode> (nodeSplitVec3)); case Update.NAME: INode nodeUpdate = new Update() as INode; return(new Node <INode> (nodeUpdate)); case LateUpdate.NAME: INode nodeLateUpdate = new LateUpdate() as INode; return(new Node <INode> (nodeLateUpdate)); case MouseButtonDown.NAME: INode nodeMouseButtonDown = new MouseButtonDown() as INode; return(new Node <INode> (nodeMouseButtonDown)); case PlayerPreferences.NAME: INode nodePlayerPref = new PlayerPreferences() as INode; return(new Node <INode> (nodePlayerPref)); case SetActive.NAME: INode nodeSetActive = new SetActive() as INode; return(new Node <INode> (nodeSetActive)); case LoadScene.NAME: INode nodeLoadScene = new LoadScene() as INode; return(new Node <INode> (nodeLoadScene)); case MousePosition.NAME: INode nodeMousePosition = new MousePosition() as INode; return(new Node <INode> (nodeMousePosition)); case ScreenToWorld.NAME: INode nodeScreenToWorld = new ScreenToWorld() as INode; return(new Node <INode> (nodeScreenToWorld)); case LookAtPosition.NAME: INode nodeLookAt = new LookAtPosition() as INode; return(new Node <INode> (nodeLookAt)); case GetComponent.NAME: INode nodeGetComponent = new GetComponent() as INode; return(new Node <INode> (nodeGetComponent)); case Color.NAME: INode nodeColor = new Color() as INode; return(new Node <INode> (nodeColor)); case Instantiate.NAME: INode instantiate = new Instantiate() as INode; return(new Node <INode> (instantiate)); case MaterialColor.NAME: INode materialColor = new MaterialColor() as INode; return(new Node <INode> (materialColor)); case Quit.NAME: INode quit = new Quit() as INode; return(new Node <INode> (quit)); case LoadTextFileAtPath.NAME: INode loadTextFileAtPath = new LoadTextFileAtPath() as INode; return(new Node <INode>(loadTextFileAtPath)); case StreamingAssetsPath.NAME: INode streamingAssetsPath = new StreamingAssetsPath() as INode; return(new Node <INode>(streamingAssetsPath)); case AddConstellationBehaviourFromJSON.NAME: INode addConstellationBehaviourFromJSON = new AddConstellationBehaviourFromJSON() as INode; return(new Node <INode>(addConstellationBehaviourFromJSON)); default: return(null); } }
object Evaluate(Instantiate i) { return(_reflection.Instantiate(i.Type.FullName, Evaluate(i.Arguments))); }
public RandomTGenerator(Instantiate i) { _instantiate = i; }