Example #1
0
        private void UpdateContents(PasserbyDescription desc)
        {
            PasserbyUI ui = GetOrCreatePopup();

            ui.ChangeContents(desc);
            currentDescription = desc;
        }
Example #2
0
    private void Grab(GameObject pnj)
    {
        pnjGrab      = pnj;
        _npcMovement = pnjGrab.GetComponent <NPCMovement>();
        _movement.KeepWeb();
        rb.isKinematic = true;
        rb.velocity    = Vector3.zero;
        animator.SetBool("IsGrab", true);
        _movement.enabled = false;

        RaycastHit2D hit = Physics2D.Raycast(transform.position, pnj.transform.position - transform.position, 100f, LayerMask.GetMask("PasserbyLayer"));

        if (hit.collider != null)
        {
            if (hit.collider.bounds.Contains(transform.position))
            {
                //transform.position = hit.collider.transform.position;
                NPC.PasserbyDescription passer = hit.collider.GetComponent <NPC.PasserbyDescription>();
                if (passer)
                {
                    transform.position = passer.Center.position;
                }
                else
                {
                    transform.position = hit.collider.transform.position;
                }
                sprite.gameObject.transform.rotation = Quaternion.Euler(0, 0, 180);
                animator.SetBool("InsidePnj", true);
            }
            else
            {
                float z = Vector3.Angle(transform.up, hit.normal);
                if (hit.normal.x > 0)
                {
                    z *= -1;
                }
                sprite.gameObject.transform.rotation = Quaternion.Euler(0, 0, z);
                transform.position = hit.point + hit.normal * grabOffsetPos;
                animator.SetBool("InsidePnj", false);
            }
        }
        else
        {
            transform.LookAt(Vector2.up);
        }

        transform.parent = pnj.transform;

        npcCursor?.ShowNPC(pnj);

        PnjGrabbed = pnj;
        IsGrab     = true;

        AudioBox.Instance?.PlaySoundOneShot(SoundOneShot.SpiderGrab);

        InputManager.Input.Spider.Web.Disable();
        InputManager.Input.Spider.Swing.Disable();
        InputManager.Input.Spider.Slide.Disable();
    }
Example #3
0
 private void DestroyPopup()
 {
     if (popup != null)
     {
         Destroy(popup.gameObject);
         currentDescription = null;
         popup = null;
     }
 }
Example #4
0
        public void ChangeContents(PasserbyDescription description)
        {
            currentDescription    = description;
            fullName.text         = $"{description.FirstName} {description.Name}";
            thoughtTaste.text     = description.Taste;
            thoughtDesire.text    = description.Desire;
            thoughtIntention.text = description.Intention;
            thoughtJudgment.text  = description.Judgment;

            score           = description.Score;
            tastePositivity = description.TastePositivity;
            thing           = description.Thing;

            facePicture.sprite = description.GetComponent <NPCVisual>().getGenderSprite();
            facePicture.color  = description.GetComponent <NPCVisual>().getGenderColor();

            faceHair.sprite = description.GetComponent <NPCVisual>().getHairSprite();
            faceHair.color  = description.GetComponent <NPCVisual>().getHairColor();
        }