content/hifi-content/thoys/dev/2017/powerChanger/powerChangerZone.js
2022-02-14 02:04:11 +01:00

41 lines
1.4 KiB
JavaScript

//
// powerChangerZone.js
//
// Created by Thijs Wenker on 3/1/17
// Copyright 2017 High Fidelity, Inc.
//
// Toggle between avatars by entering the zone
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
(function() {
var toggleURLS = [
{
modelA: 'https://s3.amazonaws.com/hifi-thoys/Thoys/thoys4c2016judasfix/thoys.fst?v',
modelB: 'http://mpassets.highfidelity.com/e76946cc-c272-4adf-9bb6-02cde0a4b57d-v1/9e8c5c42a0cbd436962d6bd36f032ab3.fst'
},
{
modelA: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/black/package/black.fst',
modelB: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/pink/package/pink.fst'
}
];
this.preload = function() {
toggleURLS.forEach(function(changePair) {
ModelCache.prefetch(changePair.modelA);
ModelCache.prefetch(changePair.modelB);
});
}
this.enterEntity = function(entityID) {
toggleURLS.forEach(function(changePair) {
if (MyAvatar.skeletonModelURL === changePair.modelA) {
MyAvatar.skeletonModelURL = changePair.modelB;
} else if (MyAvatar.skeletonModelURL === changePair.modelB) {
MyAvatar.skeletonModelURL = changePair.modelA;
}
});
};
})