예제 #1
0
    void OnTriggerStay2D(Collider2D other)
    {
        if (!hasAuthority)
        {
            return;
        }

        if (dead)
        {
            return;
        }
        if (other.tag == Tags.item)
        {
            if (MyInputs.GetButtonDown(playerControlNumber, Tags.fire) && equiped == null)
            {
                Holdable h = other.GetComponent <Holdable>();
                if (!h.IsEquiped)
                {
                    equiped = h;
                    CmdEquip(other.gameObject);
                }
            }
        }
        else if (other.tag == Tags.upgrade)
        {
            if (MyInputs.GetButtonDown(playerControlNumber, Tags.fire))
            {
                CmdPickupUpgrade(other.gameObject);
            }
        }
    }
    protected new void Start()
    {
        base.Start();
        Background.SetBackgroundColor(Color.black);
        _textStyle                  = new GUIStyle();
        _textStyle.alignment        = TextAnchor.MiddleCenter;
        _textStyle.normal.textColor = Color.white;

        _puzzle         = gameObject.AddComponent <LightsOutScript>();
        _previousInput  = mainmenu.Escape;
        mainmenu.Escape = new InputStruct(KeyCode.Escape);
        _puzzle.Open();
        (_solver = gameObject.AddComponent <LightsOutSolver>()).enabled = false;
        int keypressed = MyInputs.GetNumberPressed(Input.GetKey);

        if (Input.GetKey(KeyCode.P))
        {
            keypressed += 10;
        }
        else if (keypressed < 2)
        {
            keypressed = 10;
        }
        //Debug.Log(keypressed);
        _puzzle.CreateBoard(keypressed, keypressed, Color.red, Color.green);
        LightsOutScript.ActiveDdebug         = true;
        LightsOutScript.Square.EdgeSizeRatio = 50f / 1920f;
    }
예제 #3
0
    void Move()
    {
        float x = MyInputs.GetAxis(playerControlNumber, Tags.horizontal);
        float y = MyInputs.GetAxis(playerControlNumber, Tags.vertical);

        if (x > 0)
        {
            yRot = 0;
        }
        else if (x < 0)
        {
            yRot = 180;
        }

        if (y > 0.7)
        {
            zRot = 90;
        }
        else if (y < -0.7)
        {
            zRot = -90;
        }
        else
        {
            zRot = 0;
        }

        carryTransform.rotation  = Quaternion.Euler(0, yRot, zRot);
        spriteTransform.rotation = Quaternion.Euler(0, yRot, 0);
        rigid.velocity           = new Vector2(x * speed, rigid.velocity.y);
    }
예제 #4
0
파일: Escape.cs 프로젝트: mcolpus/quickdraw
 void Update()
 {
     if (MyInputs.GetButtonDown(0, Tags.escape))
     {
         Application.Quit();
     }
 }
예제 #5
0
 public void Initialize()
 {
     playerInput = GameObject.FindObjectOfType <PlayerInput> ();
     if (playerInput)
     {
         mInput = playerInput.GetActions <MyInputs> ();
     }
 }
예제 #6
0
        void Start()
        {
            playerInput = GameObject.FindObjectOfType <PlayerInput> ();
            if (playerInput)
            {
                mInput = playerInput.GetActions <MyInputs> ();
            }

            selectableGroup = Pools.sharedInstance.core.GetGroup(CoreMatcher.Selectable);
        }
예제 #7
0
    public void Initialize()
    {
        playerInput = GameObject.FindObjectOfType <PlayerInput> ();
        if (playerInput)
        {
            mInput = playerInput.GetActions <MyInputs> ();
        }

        var groundLayer = LayerMask.NameToLayer("Ground");

        groundMask = 1 << groundLayer;
    }
예제 #8
0
 void Jumping()
 {
     if (MyInputs.GetButtonDown(playerControlNumber, Tags.jump) && jumpsLeft > 0)
     {
         if (jumping && !(Time.time - timeWhenLeftGround < maxTimeForFreeAirJump))//they have been in the air for a while
         {
             jumpsLeft--;
         }
         //jumpsLeft--; whenever you leave the ground a jump is removed automatically
         rigid.velocity = new Vector2(rigid.velocity.x, jumpSpeed);
     }
 }
예제 #9
0
    void Update()
    {
        float y = MyInputs.GetAxisRaw(playerControllerNumber, Tags.vertical);

        if (!falling && y < -0.85 && previousYValue > -0.75)
        {
            StartCoroutine(FallThroughFloor());
        }
        if (MyInputs.GetButtonDown(playerControllerNumber, Tags.jump))
        {
        }

        previousYValue = y;
    }
    public void End()
    {
        _player = FindObjectOfType <PlayerBaseControl>();
        MyInputs.InputsOff();
        _player.MoveComponent.StartFromScratchNewEndpos(_startingRoom.Position);

        if (_blackImage.color.a != 0f)
        {
            var temp = _blackImage.color;
            temp.a            = 0f;
            _blackImage.color = temp;
        }
        _blackImage.gameObject.SetActive(true);
        _blackImage.DOFade(1.1f, 1.1f).onComplete = MoveToStart;
    }
예제 #11
0
    protected new void Awake()
    {
        base.Awake();
        AddcomponentOnDestroy = x => x.AddComponent <mainmenu>();
        if (hub == null)
        {
            hub = FindObjectOfType <Room>();
        }
        if (hub == null)
        {
            Background.SetBackgroundColor(Background.YellowishColor);
            Room.DoorType = "move";
            hub           = Floor.CreateSingleRoom(gameObject, 70f, 50f, new bool[] { false, false, true });
        }
        //Background.CreateBackgroundSquare(new Rect(hub.Position, hub.Size), Background.GreenishColor);

        SetPlayer(() => BasicLib.InitializePlayer(1000f, hub.SouthSideCentre, MyColorLib.teams[MyColorLib.green], SceneChanger.SwitchToMenu));
        MyInputs.InputsOff();
        MyCameraLib.SetCameraFollow(playerTr, CameraScript._REGULAR_ORTHOGRAPHIC_SIZE);

        var           trig    = EventObjectPlayerPosition.AddAsGameObject(hub.transform).GetComponent <EventObjectPlayerPosition>();
        BoxCollider2D boxColl = trig.AddCollider <BoxCollider2D>();

        boxColl.size        = new Vector2(Room.DoorWidth, 2f);
        trig.ActualPosition = hub.SouthSideOuter + new Vector3(0f, -boxColl.size.y / 2f);
        trig.AddAction(SceneChanger.SwitchToMenu);

        trig                = EventObjectPlayerPosition.AddAsGameObject(hub.transform).GetComponent <EventObjectPlayerPosition>();
        boxColl             = trig.AddCollider <BoxCollider2D>();
        boxColl.size        = new Vector2(Room.DoorWidth, 1f);
        trig.ActualPosition = hub.SouthSideInner + new Vector3(0f, boxColl.size.y / 2f);
        trig.AddAction(hub.OpenSouthDoor);
        trig.Once = false;

        trig                = EventObjectPlayerPosition.AddAsGameObject(hub.transform).GetComponent <EventObjectPlayerPosition>();
        boxColl             = trig.AddCollider <BoxCollider2D>();
        boxColl.size        = new Vector2(hub.Width, 3f);
        trig.ActualPosition = hub.SouthSideInner + new Vector3(0f, boxColl.size.y / 2f + 2f);
        trig.AddAction(hub.CloseSouthDoor);
        trig.Once = false;

        trig                = EventObjectPlayerPosition.AddAsGameObject(hub.transform).GetComponent <EventObjectPlayerPosition>();
        boxColl             = trig.AddCollider <BoxCollider2D>();
        boxColl.size        = new Vector2(10f, 10f);
        trig.ActualPosition = hub.SouthSideCentre;
        trig.AddAction(() => playerMoveComponent.StartFromScratchNewEndpos(hub.ProportionalPosition(0f, -0.75f)));
    }
예제 #12
0
 void Attacking()
 {
     if (equiped != null)
     {
         if (MyInputs.GetButton(playerControlNumber, Tags.fire))
         {
             CmdFire();
         }
         if (MyInputs.GetButtonDown(playerControlNumber, Tags.Throw))
         {
             CmdThrow();
             equiped = null;
         }
         else if (MyInputs.GetButtonDown(playerControlNumber, Tags.drop))
         {
             CmdDrop();
             equiped = null;
         }
     }
 }
 private void InputsOn() => MyInputs.InputsOn();