54 lines
2.2 KiB
JavaScript
54 lines
2.2 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://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/black/package/black.fst',
|
|
modelB: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/black/suited/black_suited.fst'
|
|
},
|
|
{
|
|
modelA: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/blue/package/blue.fst',
|
|
modelB: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/blue/suited/blue_suited.fst'
|
|
},
|
|
{
|
|
modelA: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/pink/package/pink.fst',
|
|
modelB: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/pink/suited/pink_suited.fst'
|
|
},
|
|
{
|
|
modelA: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/red/package/red.fst',
|
|
modelB: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/red/suited/red_suited.fst'
|
|
},
|
|
{
|
|
modelA: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/yellow/package/yellow.fst',
|
|
modelB: 'https://hifi-content.s3.amazonaws.com/ozan/dev/lionsgate/avatars/yellow/suited/yellow_suited.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;
|
|
}
|
|
});
|
|
};
|
|
})
|
|
|