Hi folks!
I need your help with a simple trigger event which should fire off a line of code, unfortunately my c# skills are "limited aka non existing.." to combine it with my fsm.
Setup: I have a box collider set to trigger, and a simple fsm which fires off a state when my player enter the trigger box.
now the tricky part: I would like to trigger the "cursor.ChangeLength(cursor.rope.Length - 1f * Time.deltaTime);" of a c#-code, when my player entered the trigger, instead of using the keyboard key for firing it off.
Could you guys help me out?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
public class CursorController : MonoBehaviour {
ObiRopeCursor cursor;
// Use this for initialization
void Start () {
cursor = GetComponentInChildren<ObiRopeCursor>();
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.W)){
cursor.ChangeLength(cursor.rope.Length - 1f * Time.deltaTime);
}
if (Input.GetKey(KeyCode.S)){
cursor.ChangeLength(cursor.rope.Length + 1f * Time.deltaTime);
}
}
}