コード例 #1
0
ファイル: Hook.cs プロジェクト: EnigmaticaGH/Hookshot
    void OnTriggerEnter2D(Collider2D c)
    {
        if (c.CompareTag("Hookable"))
        {
            partManag.SendMessage("generateSalivaSplash", transform.position + offsetToHookPoint);
            hookedObject      = c.gameObject;
            offsetToHookPoint = transform.position - hookedObject.transform.position;
            offsetToHookPoint = Quaternion.Inverse(hookedObject.transform.rotation) * offsetToHookPoint;
            Rigidbody2D hookBody = GetComponent <Rigidbody2D>();
            hookBody.isKinematic = true;
            hookBody.velocity    = Vector3.zero;
            hookGun.HookOn();
            GetComponent <CircleCollider2D>().enabled = false;
        }
        else if (!TagsToIgnore(c))
        {
            hookGun.CancelHook();
        }

        if (c.CompareTag("Edible"))
        {
            Destroy(c.gameObject);
            hookGun.CancelHook();
        }
    }
コード例 #2
0
    void Grounded(bool isGrounded)
    {
        if (isGrounded)
        {
            if (reggiebody.velocity.y <= speedForDust)
            {
                PartMang.SendMessage("generateDust", transform.position + offSet);
            }

            grounded = true;
        }
        else
        {
            if (!isRunning)
            {
                StartCoroutine(SetGrounded(isGrounded));
            }
        }
    }
コード例 #3
0
    void FixedUpdate()
    {
        if (!triggerMove)
        {
            setHorizontalAxis(Input.GetAxisRaw("Horizontal"));
        }

        stateProcesses[(int)state]();
        if (speed > defaultMaxSpeed)
        {
            speed -= MOVESPEED_DECREASE_DELTA * Time.deltaTime * Mathf.Pow(speed / defaultMaxSpeed, 3);
        }
        else
        {
            speed = defaultMaxSpeed;
        }
        if (Mathf.Abs(player.velocity.x) >= speedForParticles)
        {
            PEM.SendMessage("generateSpeedParticles", transform.position);
        }
    }