public override void OnAttach(ActorInstantiationDetails details) { base.OnAttach(details); int length = (details.Params[0] > 0 ? details.Params[0] : 8); speed = (details.Params[1] > 0 ? details.Params[1] : 8) * 0.00625f; // "Event" parameter will not be implemented collisionFlags &= ~(CollisionFlags.ApplyGravitation | CollisionFlags.SkipPerPixelCollisions); untouched = false; // Workaround: Some animation have to be loaded for collision detection RequestMetadata("Object/GemGiant"); SetAnimation(AnimState.Idle); renderer.Active = false; parts = new GemPart[length]; for (int i = 0; i < parts.Length; i++) { parts[i] = new GemPart(); parts[i].OnAttach(details); parts[i].Parent = this; parts[i].Transform.Scale = 0.8f; } }
protected override async Task OnActivatedAsync(ActorActivationDetails details) { await base.OnActivatedAsync(details); int length = (details.Params[0] > 0 ? details.Params[0] : 8); speed = (details.Params[1] > 0 ? details.Params[1] : 8) * 0.00625f; // "Event" parameter will not be implemented CollisionFlags = CollisionFlags.CollideWithOtherActors | CollisionFlags.SkipPerPixelCollisions; untouched = false; await RequestMetadataAsync("Collectible/Gems"); parts = new GemPart[length]; for (int i = 0; i < parts.Length; i++) { GemPart part = new GemPart(); part.OnActivated(details); part.Parent = this; part.Transform.Scale = 0.8f; parts[i] = part; } }