Exemple #1
0
    private void Start()
    {
        movement  = GetComponent <PlayerMovement>();
        stats     = GetComponent <PlayerStats>();
        rigidBody = GetComponent <Rigidbody2D>();
        fishing   = GetComponent <PlayerFishing>();
        classUlt  = GetComponent <ClassUltimate>();
        helpMenu  = GetComponentInChildren <PlayerMenu>();
        helpMenu.frame.SetActive(false);
        playerInventory.gameObject.SetActive(true);

        /* Assume one camera exists */
        cam = GameObject.FindObjectOfType <UI_Camera>();
    }
Exemple #2
0
    public static Bobber Create(GameObject prefab, PlayerFishing source, Vector2 target, int baitType)
    {
        //baitType changes some conditions, but it is not programmed yet

        Bobber      obj = Instantiate(prefab, source.transform.position, Quaternion.identity).GetComponent <Bobber>();
        Rigidbody2D rigid;

        if (obj && (rigid = obj.GetComponent <Rigidbody2D>()))
        {
            obj.source = source;
            Vector2 velocity = (target - (Vector2)obj.transform.position).normalized * source.castingSpeed;
            rigid.velocity = velocity;
        }
        obj.baitType = baitType;

        return(obj);
    }
Exemple #3
0
    void Awake()
    {
        if (singleton == null)
        {
            singleton = this;
        }

        if (this != singleton)
        {
            Destroy(this);
            return;
        }

        this.animator = GetComponent <Animator>();

        this.controls = new PlayerControls();
        this.controls.Gameplay.ToggleItem.performed += ctx => ToggleFishing();

        this.playerMovement = GetComponent <PlayerMovement>();

        this.lureMovement = lure.gameObject.GetComponent <LureMovement>();
    }