public void Init(uint ownerID, uint runtimeID, string propName, bool appearAnim = false) { this.config = PropObjectData.GetPropObjectConfig(propName); base.commonConfig = this.config.CommonConfig; this.Init(runtimeID); this._timeScaleStack = new FixedStack <float>(8, null); this._timeScaleStack.Push(1f, true); if ((Singleton <LevelManager> .Instance != null) && (Singleton <LevelManager> .Instance.levelEntity != null)) { this._timeScale = this._lastTimeScale = this._timeScaleStack.value * Singleton <LevelManager> .Instance.levelEntity.TimeScale; } else { this._timeScale = this._lastTimeScale = this._timeScaleStack.value; } if (Singleton <EventManager> .Instance != null) { this.owner = (BaseMonoAbilityEntity)Singleton <EventManager> .Instance.GetEntity(ownerID); } if ((this.config.PropArguments != null) && !this.config.PropArguments.IsTargetable) { base.SetCountedDenySelect(true, true); } if ((this.config.PropArguments != null) && (this.config.PropArguments.Duration > 0f)) { base.StartCoroutine(this.WaitDestroyByDuration(this.config.PropArguments.Duration)); } if (appearAnim) { this.Appear(); } }
private void CreateLevelProp(string propName) { ConfigPropObject propObjectConfig = PropObjectData.GetPropObjectConfig(propName); float hP = propObjectConfig.PropArguments.HP; float attack = propObjectConfig.PropArguments.Attack; Vector3 position = this.collideCenterTransform.position; position.y = 0f; Singleton <PropObjectManager> .Instance.CreatePropObject(this.owner.GetRuntimeID(), propName, hP, attack, position, this.collideCenterTransform.forward, false); }
public uint CreatePropObject(uint ownerID, string propName, float HP, float attack, Vector3 initPos, Vector3 initDir, bool appearAnim = false) { ConfigPropObject propObjectConfig = PropObjectData.GetPropObjectConfig(propName); BaseMonoPropObject component = UnityEngine.Object.Instantiate <GameObject>(Miscs.LoadResource <GameObject>(propObjectConfig.PrefabPath, BundleType.RESOURCE_FILE)).GetComponent <BaseMonoPropObject>(); uint nextRuntimeID = Singleton <RuntimeIDManager> .Instance.GetNextRuntimeID(7); component.transform.position = initPos; component.transform.forward = initDir; component.Init(ownerID, nextRuntimeID, propObjectConfig.Name, appearAnim); if ((propName == "JokeBox") && (attack <= 0f)) { (component as MonoBarrelProp)._toExplode = false; } this._propObjects.Add(nextRuntimeID, component); this._propLs.Add(component); PropObjectActor actor = Singleton <EventManager> .Instance.CreateActor <PropObjectActor>(component); actor.ownerID = ownerID; actor.InitProp(HP, attack); actor.PostInit(); return(nextRuntimeID); }