public void RegisterKey(StoredObject key) { PublicKey newKey = gameObject.AddComponent(key.objectType) as PublicKey; if (!ReflectionUtil.ApplyStoredObject(key, newKey)) { return; } newKey.isAvailable = true; keys.Add(newKey); }
public bool InstallComponent(out EntityComponent installedComponent, StoredObject storedObject) { installedComponent = Player.I.gameObject.AddComponent(storedObject.objectType) as EntityComponent; if (installedComponent == null) { return(false); } ReflectionUtil.ApplyStoredObject(storedObject, installedComponent); onInstall.Invoke(installedComponent); return(true); }
protected override void DealDamage(IDamageable target) { base.DealDamage(target); foreach (StoredObject storedOnHitCondition in onHitConditions) { Condition newCondition = target.GetGameObject().AddComponent(storedOnHitCondition.objectType) as Condition; if (newCondition == null) { continue; } ReflectionUtil.ApplyStoredObject(storedOnHitCondition, newCondition); newCondition.Init(this); } }