Example #1
0
    // Update is called once per frame
    void Update()
    {
        Vector2 position = transform.position;

        switch (ims)
        {
        case IsolationMovementState.Neutral:
            if (Random.Range(0, 1000) < 1 || !((position.x >= (startLocation.x - patrolDistance)) && (position.x <= (startLocation.x + patrolDistance))))
            {
                transform.Rotate(0, 180, 0);
            }

            break;

        case IsolationMovementState.Attacking:
            break;

        default:
            ims = IsolationMovementState.Neutral;
            break;
        }
    }
Example #2
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     Debug.Log(collision.name + " no longer isolated");
     ims = IsolationMovementState.Neutral;
 }
Example #3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Debug.Log(collision.name + " entered isolation");
     ims = IsolationMovementState.Attacking;
 }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     ims           = IsolationMovementState.Neutral;
     startLocation = transform.position;
 }