#include "scripts/bp_common.txt"
#include "scripts/common.txt"

class ChallengeKey : ScriptObject {
    kActor @self;
	float turnSpeed = Math::Deg2Rad(1);
	int cType;
	//------------------------------------------------------------------------------------------------------------------------
    ChallengeKey(kActor @actor) {
        @self = actor;
		cType = 1;
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnTick(void) {
		self.Yaw() += turnSpeed;
		if (InRadius(self.Origin(), 60.0f)) {
			if (!HasChallengeKey(cType)) {
				Game.PlaySound("sounds/shaders/health_pickup_1.ksnd");
				Game.PrintLine("Challenge Key", 0);
				SetChallengeKey(cType, true);
				self.Remove();
			}
		}
    }
	//------------------------------------------------------------------------------------------------------------------------
    void OnSpawn(void) {
    }
	//------------------------------------------------------------------------------------------------------------------------
};
