Exemple #1
0
        public override void Start()
        {
            base.Start();

            Character = Entity.Get <CharacterComponent>();
            Animation = Entity.Get <DroneAnimation>();
            if (Animation == null)
            {
                Animation = new DroneAnimation {
                    Animation = Model.Entity.Get <AnimationComponent>()
                };
                Entity.Add(Animation);
            }

            // Store original bone data, so they can be modified later
            for (int i = 0; i < Model.Skeleton.Nodes.Length; ++i)
            {
                var   nodeRot = Model.Skeleton.NodeTransformations[i].Transform.Rotation;
                var   mat = Matrix.RotationQuaternion(nodeRot);
                float yaw, pitch, roll;
                mat.Decompose(out yaw, out pitch, out roll);
                var node = Model.Model.Skeleton.Nodes[i];
                bones[node.Name] = new Bone
                {
                    EulerAngles = new Vector3(yaw, pitch, roll)
                };
            }

            Entity.Transform.PostOperations.Add(new DronePostTransformUpdater {
                Drone = this
            });

            // Engine sound
            engineSound           = EngineAudioEmitter["Engine"];
            engineSound.IsLooping = true;
            engineSound.Play();

            // Load sounds
            AudioEmitter = Entity.Get <AudioEmitterComponent>();
            deathSound   = AudioEmitter["Death"];

            // Load the variable amount of being hit sounds, "Hit0", "Hit1", etc.
            hitSounds = new RandomSoundSelector(AudioEmitter, "Hit");

            initialHeight = Model.Entity.Transform.Position.Y;

            weapon?.Init(this);
        }
        public override async Task Execute()
        {
            explosionSoundSelector = new RandomSoundSelector(Entity.Get <AudioEmitterComponent>(), "Explode");

            await base.Execute();
        }
Exemple #3
0
        public override void Init(Drone drone)
        {
            base.Init(drone);

            shootSoundSelector = new RandomSoundSelector(ProjectileSpawnPoint.Get <AudioEmitterComponent>(), "Fire");
        }