Ejemplo n.º 1
0
        private IEnumerator WaitForProvider()
        {
            while (Provider == null)
            {
                yield return(WaitFor.EndOfFrame);
            }

            Acu = Provider.GetComponent <AirController>();

            var acuName = Acu.name.StartsWith("ACU - ") ? Acu.name.Substring("ACU - ".Length) : Acu.name;

            // "ACU - " as per NameValidator tool.
            acuLabel.SetValueServer(acuName);

            foreach (var netPage in pageSwitcher.Pages)
            {
                var page = netPage as GUI_AcuPage;
                page.Acu   = Acu;
                page.AcuUi = this;
            }

            editValueModal.Acu   = Acu;
            editValueModal.AcuUi = this;

            OnTabOpened.AddListener(TabOpened);
            OnTabClosed.AddListener(TabClosed);
            if (IsUnobserved == false)
            {
                // Call manually; OnTabOpened is invoked before the Provider is set,
                // so the initial invoke was missed.
                TabOpened();
            }
        }
Ejemplo n.º 2
0
    void Start()
    {
        canvas = GameObject.Find("Canvas");
        //如果游戏在运行,暂停菜单不显示
        if (Time.timeScale == 1)
        {
            canvas.SetActive(false);
        }

        Audio = GetComponent <AudioSource>();
        Audio.Pause();
        //音频从第1秒开始
        //double startTime = AudioSettings.dspTime + 1.0;
        //Audio.PlayScheduled(startTime);


        test = GameObject.Find("FJ");
        ac   = new AirController(test, Steering_speed);
        ac.TranslateSpeed1 = TranslateSpeed;
        //GameObject.Find("TestAir").SetActive(true);//设置游戏对象的是否激活(显示)
        airfoil       = GameObject.Find("cacac").GetComponent <Animator>();
        airfoil.speed = 0f;
        //获取组件
        rigidbody_Fj = test.GetComponent <Rigidbody>();
    }
Ejemplo n.º 3
0
 public MovementController(string joystickName, int joystickID)
 {
     this.joystickID   = joystickID;
     this.joystickName = joystickName;
     airController     = new AirController(joystickID);
     groundController  = new GroundController(joystickID);
     waterController   = new WaterController(joystickID);
 }
    private void Awake()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;

        _rb              = GetComponent <Rigidbody2D>();
        listener         = Camera.main.GetComponent <AudioListener>();
        mainCameraSource = Camera.main.GetComponent <AudioSource>();
        _physics         = new PhysicsCalculation();
        _physics.CalculateGravity(stats.jumpHeight, stats.timeToApex);
        Physics.gravity  = Vector3.zero;
        _rb.gravityScale = 0;
        yVelocity        = 0;
        _applyPhysics    = ApplyGravity;

        _detectFloor = DetectGroundFromGround;

        _groundKeys = new GroundController().SetModel(this);
        _airKeys    = new AirController().SetModel(this);
        _ladderKeys = new LadderController().SetModel(this);
        _chainKeys  = new ChainController().SetModel(this);

        stats.hp = stats.maxHP;

        _currentSpeed = stats.walkingSpeed;

        _checkpointPosition = transform.position;

        AddNewSkin(Resources.Load <Skin>("Skins/Latin_Lover_Skin"));
        SkillsAndValues.Add(_mySkins[0], () => { return(-1); });

        if (skillJet)
        {
            AddNewSkin(Resources.Load <Skin>("Skins/Jetpack_Skin"));
            GameObject.Find("JET").SetActive(true);
        }

        if (skillBowser)
        {
            AddNewSkin(Resources.Load <Skin>("Skins/Bowser_Skin"));
            GameObject.Find("BOW").SetActive(true);
        }

        if (skillFRQ)
        {
            AddNewSkin(Resources.Load <Skin>("Skins/FusRohCuack_Skin"));
            GameObject.Find("FRQ").SetActive(true);
        }
        //AddNewSkin(Resources.Load<Skin>("Skins/Bowser_Skin"));
        //SkillsAndValues.Add(_mySkins[1], () => { return -1; });
        //AddNewSkin(Resources.Load<Skin>("Skins/FusRohCuack_Skin"));
        //SkillsAndValues.Add(_mySkins[2], () => { return currentPointsFRC; });
        //AddNewSkin(Resources.Load<Skin>("Skins/Jetpack_Skin"));
        //SkillsAndValues.Add(_mySkins[3], () => { return currentPointsJetPack; });
    }
Ejemplo n.º 5
0
        public PlatformerController(Body body, CollisionType groundType, 
            Keys upKey = Keys.W, Keys leftKey = Keys.A, Keys downKey = Keys.S, Keys rightKey = Keys.D, Keys jumpKey = Keys.Space)
        {
            _body = body;
            _groundControl = new GroundController(body, leftKey, rightKey);
            _airControl = new AirController(body);

            _jumpControl = Add(new JumpController(body, jumpKey));

            Add(new KeyBinding(Keys.LeftShift, SetLightSpeed, SetDefaultState));
            Add(new KeyBinding(Keys.LeftControl, SetControlMode, SetDefaultState));

            _body.CreateContactHandler(groundType, f => SetGroundControl(), f => SetAirControl());
            SetAirControl();
        }
Ejemplo n.º 6
0
 public MainLoop(int updateInterval)
 {
     UpdateInterval = updateInterval;
     AirController  = new AirController();
 }
Ejemplo n.º 7
0
 public MainLoop()
 {
     UpdateInterval = 30000;
     AirController  = new AirController();
 }