void OnWizardCreate()
    {
        DialogItem first = items[0];
        DialogItem last = items[items.Count - 1];
        if (mainGameObject != null)
        {
            StopNav nav = new StopNav();
            nav.Initilize(ref first, NodeActionType.OnDialogFocused);
            nav.SetNodeTarget(ref mainGameObject);
            first.onNodeFocusedActions.Add(nav);
        }
        if (mainGameObject != null && lookAtTarget != null)
        {
            LookAtGameObject lookAt = new LookAtGameObject();
            lookAt.Initilize(ref first, NodeActionType.OnDialogFocused);
            lookAt.SetLooker(ref mainGameObject);
            lookAt.SetTarget(ref lookAtTarget);
            first.onNodeFocusedActions.Add(lookAt);
        }
        if (animationToPlay != "")
        {
            PlayAnimation anim = new PlayAnimation();
            anim.Initilize(ref first, NodeActionType.OnDialogFocused);
            anim.SetNodeTarget(ref mainGameObject);
            first.onNodeFocusedActions.Add(anim);

        }
        if (animationLeave != "")
        {
            PlayAnimation anim = new PlayAnimation();
            anim.Initilize(ref last, NodeActionType.OnDialogLeave);
            anim.SetNodeTarget(ref mainGameObject);
            last.onNodeLeaveActions.Add(anim);
        }
        if (mainGameObject != null)
        {
            EndConvoActions end = new EndConvoActions();
            end.Initilize(ref last, NodeActionType.OnDialogLeave);
            last.onNodeLeaveActions.Add(end);
        }
        CleanUp();
    }
Example #2
0
    void Start()
    {
        // Set up references
        enemySight = GetComponentInChildren<EnemySight> ();
        nav = GetComponent<NavMeshAgent> ();
        attackMomentumTimer = 0f;
        chaseTimer = 0f;
        reactionTime = Random.Range (avgReactionTime * 0.9f, avgReactionTime * 1.1f);
        ResetAttackMomentumTime ();

        playerStats = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<PlayerStats> ();

        if(initialPosition){
            navPosition = initialPosition.position;
        }
        else{
            navPosition = transform.position;
        }

        // Set up target info if there is an initial target...
        lookAtGameObject = GetComponent<LookAtGameObject> ();
        if(lookAtGameObject.target != null){
            UpdateTarget ();
        }

        isAttacking = false;
        wasPatrolling = true;

        if(gameObject.GetComponentInChildren<weaponIndex>().ammoCount == 0){
            isMelee = true;
        }
    }
Example #3
0
    void Start()
    {
        nav = GetComponentInParent<NavMeshAgent> ();
        //col = transform.GetComponent<SphereCollider> ();
        enemyAI = GetComponentInParent<EnemyAI> ();

        // Set up target info if there is an initial target...
        lookAtGameObject = GetComponentInParent<LookAtGameObject> ();

        personalLastSighting = targetResetPosition;
        playerStats = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<PlayerStats> ();

        //Determine Random sightlessScreenBufferPercentage
        sightlessScreenBufferPercentage = Random.Range (sightlessScreenBufferPercentageMin, sightlessScreenBufferPercentageMax)/100f;
    }
 void Awake()
 {
     col = GetComponent<SphereCollider> ();
     lookAtGameObject = GetComponentInParent<LookAtGameObject> ();
 }