SnakeDirectionInput.js 890 B

123456789101112131415161718192021222324252627282930313233343536
  1. var o0 = require('o0');
  2. var o0CC = require('o0CC');
  3. cc.Class({
  4. extends: cc.CircleCollider,
  5. properties: {
  6. control:null,
  7. },
  8. setTargetSpeeding:function(bool){
  9. if(this.control==null){
  10. return;
  11. }
  12. this.control.setTargetSpeeding(bool);
  13. },
  14. setTargetVector:function(vector){
  15. if(this.control==null){
  16. return;
  17. }
  18. this.control.setTargetVector(vector);
  19. },
  20. removeTargetVector:function(vector){
  21. if(this.control==null){
  22. return;
  23. }
  24. this.control.removeTargetVector(vector);
  25. },
  26. // use this for initialization
  27. onLoad: function () {
  28. this.control = this.node.getComponent('LocalControl');
  29. },
  30. update: function (dt) {
  31. if(this.node == null || this.node.isValid == false){
  32. cc.log("Memory leak: Input");
  33. }
  34. },
  35. });