Example #1
0
 // Use this for initialization
 void Start()
 {
     player             = GameObject.FindGameObjectWithTag("Player");
     aiCharacterControl = GetComponent <AICharacterControl> ();
     animator           = GetComponent <Animator>();
     //OverrideAnimatorController ();
 }
        private void LoadPlayerGroup()
        {
            int i = 0;

            for (i = 0; i < GlobalGameInfo.PlayerGroupData._GroupMemberGameObjects.Count; i++)
            {
                UnityEngine.Object tmp = null;
                tmp = Instantiate(GlobalGameInfo.PlayerGroupData._GroupMemberGameObjects[i], new Vector3(0f, 0f, 0f), new Quaternion());
                GameObject newGO = null;
                newGO = (GameObject)tmp;

                GlobalGameInfo.PlayerGroupData._GroupMemberGameObjects[i] = newGO;

                //set the target for any AI characters to the member in front of them in the group
                AICharacterControl AI = null;
                AI = newGO.GetComponent <AICharacterControl>();
                if (AI != null && GlobalGameInfo.PlayerGroupData._GroupMemberGameObjects.Count > 0)
                {
                    AI.target = GlobalGameInfo.PlayerGroupData._GroupMemberGameObjects[i - 1];
                }

                //store the CharacterData script Components
                Component t = null;
                t = newGO.GetComponent("CharacterData");
                CharacterData temp = null;
                temp = (CharacterData)t;
                GlobalGameInfo.PlayerGroupData._groupMemberCharacterData.Add(temp);
            }
        }
Example #3
0
 void Start()
 {
     aiCharacterControl     = GetComponent <AICharacterControl>();
     player                 = GameObject.FindGameObjectWithTag("Player");
     startLocation          = new GameObject("EnemyStart").GetComponent <Transform>();
     startLocation.position = transform.position;
 }
Example #4
0
 void Start()
 {
     alarms             = GameObject.FindObjectOfType <Alarms>().GetComponent <Alarms>();
     firemanInventory   = GetComponent <Inventory>();
     aiCharacterControl = GetComponent <AICharacterControl>();
     CheckExtinguisher();
 }
Example #5
0
    void Start()
    {
        aiCharacterController = GetComponent <AICharacterControl> ();
        SetPlayers();

        InvokeRepeating("CmdSetTarget", 1, 0.2f);
    }
 private void Awake()
 {
     if (characterControl == null)
     {
         characterControl = GetComponentInChildren <AICharacterControl>();
     }
 }
Example #7
0
 // Use this for initialization
 void Start()
 {
     player            = GameObject.Find("Player");
     controller        = GetComponent <AICharacterControl>();
     controller.target = SelectDestination();
     currentWp         = controller.target;
 }
Example #8
0
 public void togglePause()
 {
     HeroMain.togglePause();
     AICharacterControl.togglePause();
     AIBossCharacterControl.togglePause();
     ThirdPersonUserControl.togglePause();
 }
Example #9
0
 void Start()
 {
     thirdPersonCharacter = GetComponent <ThirdPersonCharacter>();
     aICharacterControl   = GetComponent <AICharacterControl>();
     player           = GameObject.FindGameObjectWithTag("Player");
     startingLocation = transform.position;
 }
Example #10
0
 // Use this for initialization
 void Start()
 {
     aiCharacter = GetComponent <AICharacterControl>();
     anim        = GetComponent <Animator>();
     player      = GameObject.FindGameObjectWithTag("Player");
     currentHP   = maxHP;
 }
Example #11
0
    public float moanRate = 3f; //Moan once every 3 seconds

    void Start()
    {
        aICharacterControl = GetComponent <AICharacterControl>();
        audioSource        = GetComponent <AudioSource>();
        player             = aICharacterControl.playerCharacter;
        sceneLoader        = FindObjectOfType <SceneLoader>();
    }
Example #12
0
 void Start()
 {
     _player             = GameObject.FindGameObjectWithTag("Player");
     _agent              = GetComponent <NavMeshAgent>();
     _aiCharacterControl = GetComponent <AICharacterControl>();
     _agent.autoBraking  = false;
 }
    void Start()
    {
        waypointController   = GetComponent <WaypointController>();
        zombieAnimator       = GetComponent <Animator>();
        sensor               = GetComponent <EnemySensor>();
        characterControl     = GetComponent <AICharacterControl>();
        attackRangeChecker   = GetComponent <AttackRangeChecker>();
        thirdPersonCharacter = GetComponent <ThirdPersonCharacter>();

        attackRangeChecker.enabled = false;

        //Add in animation events
        AnimationClip[] animationClips = zombieAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in animationClips)
        {
            //We want to add a function to be called when the zombie attack is a place
            if (clip.name == "Zombie Attack")
            {
                AnimationEvent animationEvent = new AnimationEvent();
                animationEvent.functionName = "AttackAnimationComplete";
                //Animation time for a place where this could hit
                animationEvent.time = 1.13f;
                clip.AddEvent(animationEvent);
            }
            if (clip.name == "Zombie Death")
            {
                AnimationEvent animationEvent = new AnimationEvent();
                animationEvent.functionName = "DeathAnimationComplete";
                animationEvent.time         = clip.length;
                clip.AddEvent(animationEvent);
            }
        }
    }
 public override void TalkTo(AICharacterControl context)
 {
     if (!context.IsDead)
         context.IsScared = false;
         context.moveState = MoveState.Follow;
         context.SetState(new AICharacterStateFollow());
 }
Example #15
0
    void Start()
    {
        playerComp = FindObjectOfType <Player> ();
        playerComp.notifyOnLevelingUpObservers += PlayerLeveledUp;

        if (enemyLevel > 1)
        {
            for (int i = 0; i < enemyLevel - 1; i++)
            {
                float tempHealth = (maxHealthPoints *= 1.22f);
                maxHealthPoints = tempHealth - ((tempHealth / 700f) * 25f);
            }
        }
        if (enemyLevel > 1)
        {
            for (int i = 0; i < enemyLevel - 1; i++)
            {
                damagePerShot *= 1.21f;
            }
        }
        currentHealthPoints = maxHealthPoints;
        thisBasePoint       = Instantiate(basePoint, transform.position, transform.rotation, transform.parent);

        initialMoveRadius = moveRadius;

        player        = GameObject.FindGameObjectWithTag("Player");
        aiCharControl = GetComponent <AICharacterControl> ();
    }
 private void Awake()
 {
     navMesh            = GetComponent <NavMeshAgent>();
     aICharacterControl = GetComponent <AICharacterControl>();
     estados            = GetComponent <ControladorIA.Estados>();
     projectil          = GetComponent <ProjectilScript>();
 }
 public override void Scare(AICharacterControl context)
 {
     context.SetState(new AICharacterStateStand());
     context.IsScared = true;
     context.playerController.Tell("Kelly", "Oh...I'm so scared");
     context.moveState = MoveState.Stand;
 }
Example #18
0
 void Start()
 {
     healthBar          = GetComponentInChildren <EnemyHealthBar>();
     currentHealth      = maxHealthPoints;
     aiCharacterControl = GetComponent <AICharacterControl>();
     player             = GameObject.FindGameObjectWithTag("Player");
 }
Example #19
0
    // Use this for initialization
    void Start()
    {
        rb    = GetComponent <Rigidbody>();
        agent = GetComponent <NavMeshAgent>();
        characterController = GetComponent <AICharacterControl>();
        inLightCone         = false;
        lastknownPosition   = new GameObject();
        wanderTarget        = new GameObject();

        if (patrolPoints.Length == 0)
        {
            patrolPoints = GameObject.FindGameObjectsWithTag("Patrol Point");

            IComparer myComparer = new patrolPointSorter();
            Array.Sort(patrolPoints, myComparer);
        }

        if (startingPatrolIndex >= patrolPoints.Length)
        {
            startingPatrolIndex = 0;
        }



        patrolIndex = startingPatrolIndex;


        GetNextDestination();
        stoppingDistance = agent.radius * 1.3f;

        isStunned = false;

        timer = attackTiming;
    }
Example #20
0
// -- Game loops

        void Start()
        {
            _aiController          = GetComponent <AICharacterControl>();
            _moveTarget            = new GameObject("Player Move Target");
            _meleeAttackController = GetComponent <MeleeWeaponAttack>();
            Camera.main.GetComponent <CameraRaycaster>()._notifyMouseClicked += ProcessMouseClick;
        }
Example #21
0
    //START
    void Start()
    {
        //FETCH CONTROLLERS
        worldController = FindObjectOfType <WorldController>();
        aiCharacter     = GetComponent <AICharacterControl>();

        //OPINIONS
        if (likedActivities == null)
        {
            likedActivities = new List <string>();
        }
        if (dislikedActivities == null)
        {
            dislikedActivities = new List <string>();
        }

        //DIALOGUES
        if (likedDialogues == null)
        {
            likedDialogues = new Dictionary <string, string>();
        }
        if (dislikedDialogues == null)
        {
            dislikedDialogues = new Dictionary <string, string>();
        }

        if (likedActivities.Count == 0 && dislikedActivities.Count == 0)
        {
            DecideOpinions();
        }
    }
Example #22
0
 // Start is called before the first frame update
 void Start()
 {
     aiControl = GetComponent <AICharacterControl>();
     if (aiControl.target == null)
     {
         UpdateTarget();
     }
 }
Example #23
0
 void Start()
 {
     //rb = GetComponent<Rigidbody2D>();
     player         = GameObject.FindGameObjectWithTag("Player");
     gameController = (GameController)GameObject.FindGameObjectWithTag("GameController").GetComponent(typeof(GameController));
     aiControl      = (AICharacterControl)gameObject.GetComponent(typeof(AICharacterControl));
     aiControl.SetTarget(player.transform);
 }
Example #24
0
    // Use this for initialization
    void Start()
    {
        target = GetComponent <AICharacterControl>();
        CapsuleCollider collider = GetComponent <CapsuleCollider>();

        collider.height = GetComponent <NavMeshAgent>().height;
        collider.center = new Vector3(0, collider.height / 2f, 0);
    }
Example #25
0
 // Use this for initialization
 void Start()
 {
     agent                = GetComponent <UnityEngine.AI.NavMeshAgent>();
     aiCharacter          = GetComponent <AICharacterControl>();
     player               = GameObject.FindGameObjectWithTag("Player");
     agent.updateRotation = false;
     agent.updatePosition = true;
 }
Example #26
0
 void Start()
 {
     Health          = HealthMax;
     ThePlayer       = GameObject.FindGameObjectWithTag("Player");
     ThePlayerScript = ThePlayer.GetComponent <Player>();
     AIControl       = GetComponent <AICharacterControl>();
     HealTimer       = new Timer(HealCooldown);
 }
        public override void Act(GameObject player, GameObject npc)
        {
            AICharacterControl   ai        = npc.GetComponent <AICharacterControl>();
            ThirdPersonCharacter character = npc.GetComponent <ThirdPersonCharacter>();

            ai.agent.SetDestination(player.transform.position);
            character.Move(ai.agent.desiredVelocity, false, false);
        }
Example #28
0
    private void MoveToDestination(Vector3 _destination)
    {
        AICharacterControl AIController = GetComponent <AICharacterControl>();

        AIController.SetTarget(_destination);

        //m_navMeshAgent.SetDestination(_destination);
    }
Example #29
0
 void Start()
 {
     cameraRaycaster      = Camera.main.GetComponent <CameraRaycaster>();
     thirdPersonCharacter = GetComponent <ThirdPersonCharacter>();
     aiCharacterControl   = GetComponent <AICharacterControl>();
     walkTarget           = new GameObject("walkTarget");
     cameraRaycaster.notifyMouseClickObservers += OnMouseClick; // adding to the set of observers of CameraRaycast
 }
Example #30
0
    IEnumerator MoveBuyerOnce(AICharacterControl buyerAI, float delayTime)
    {
        yield return(new WaitForSeconds(delayTime));

        buyerAI.agent.stoppingDistance = 0.1f;
        buyerAI.agent.speed            = 0.2f;
        buyerAI.StepForward(1f);
    }
Example #31
0
 private void Start()
 {
     player                   = GameObject.FindGameObjectWithTag("Player");
     aiCharacterControl       = GetComponent <AICharacterControl>();
     nmAgent                  = GetComponent <NavMeshAgent>();
     nmAgent.stoppingDistance = attackRadius;
     currentHealthPoints      = maxHealthPoints;
 }
Example #32
0
 private void Start()
 {
     cameraRaycaster    = Camera.main.GetComponent <CameraRaycaster>();
     m_Character        = GetComponent <ThirdPersonCharacter>();
     currentClickTarget = transform.position;
     aICharacterControl = GetComponent <AICharacterControl>();
     walkTarget         = new GameObject("walkTarget");
 }
Example #33
0
 void Awake()
 {
     if(_animator == null)
         _animator = GetComponent<Animator>();
     
     _aiController = GetComponent<AICharacterControl>();
     _thirdPersonController = GetComponent<ThirdPersonCharacter>();
     _characterController = GetComponent<CharacterController>();
 }
 public virtual void Kill(AICharacterControl context)
 {
     context.IsDead = true;
     context.SetState(new AICharacterStateDead());
     context.playerController.Tell("Kelly", "I'm...sorry...I...failed...");
     context.Skeleton.SetActive(true);
     context.Body.SetActive(false);
     context.moveState = MoveState.Stand;
 }
Example #35
0
    void Start()
    {
        // state = State.LEAVE;
        // GameObject god = GameObject.Find("God");
        // God godScript = god.GetComponent<God>();
        // God.startRitual += new EventHandler(Pray);
        state = State.WANDER;
        outerPoint = GameObject.Find("OuterPoint");
        map = GameObject.Find("map");
        mapCollider = map.GetComponent<Collider>();

        navMeshAgent = GetComponent<NavMeshAgent>();
        character = GetComponent<ThirdPersonCharacter>();
        characterControl = GetComponent<AICharacterControl>();

        StartCoroutine(GetTargetLoop(UnityEngine.Random.Range(1f, 2f) * 2f));
        StartCoroutine(IAStateMachine());
    }
Example #36
0
    // Use this for initialization
    void Start()
    {
        vision = GetComponent<VisionControl>();
        nav = GetComponent<AICharacterControl>();
        ani = GetComponent<Animator>();

        waypointIndex = 0;

        isLooking = false;

        currentWaypoint = Waypoints[waypointIndex];

        state = "Patrol";

        nav.target = currentWaypoint;

        pm = GameObject.FindObjectOfType<PlayerManager>().GetComponent<PlayerManager>();
    }
Example #37
0
    void FixedUpdate()
    {
        if (currentPlayer == null || currentPlayer.isPlaying == false)
        {
            foreach (AICharacterControl player in aiCharacters)
            {
                if (player.currentCooldown == 0)
                {
                    currentPlayer = player;
                    player.beginTurn();
                    return;
                }
            }

            foreach (AICharacterControl player in aiCharacters)
            {
                player.currentCooldown--;
            }
        }
    }
Example #38
0
    /*void switchToPlayer(inputToEnable, inputToDisable, cameraLocation)
    {
        inputToEnable.enabled = true;
        inputToDisable.enabled = false;

        defaultCamera.transform.position = cameraLocation.transform.position;
        defaultCamera.transform.rotation = cameraLocation.transform.rotation;}*/
    // Use this for initialization
    void Start()
    {
        ragsUserControl = GameManager.god.ragsObject.GetComponent<ThirdPersonUserControl>();
           ragsAIControl = GameManager.god.ragsObject.GetComponent<AICharacterControl>();

           reasonUserControl = GameManager.god.reasonObject.GetComponent<BallUserControl>();
           reasonToRags = GameManager.god.reasonObject.GetComponent<FollowRags>();

           ragsPlayerCam = GameManager.god.ragsCam;
           reasonPlayerCam = GameManager.god.reasonCam;

           //ragsUserControl.enabled = playerRagsActive;
           //reasonUserControl.enabled = playerReasonActive;

           //ragsPlayerCam.enabled = playerRagsActive;
           //reasonPlayerCam.enabled = playerReasonActive;

        //player1Input = player1.GetComponent("(your controller)");
        //player2Input = player2.GetComponent("(your controller)");
    }
Example #39
0
        private void Awake()
        {
            // Setup references.
            m_RigidBody = GetComponent<Rigidbody>();
            m_Collider = GetComponent<Collider>();
            m_AiCharacter = GetComponent<AICharacterControl>();
            m_Agent = GetComponent<NavMeshAgent>();
            m_Animator = GetComponent<Animator>();

            // Set the position that the player will be reset to.
            m_OriginPosition = transform.position;
        }
Example #40
0
 // Use this for initialization
 void Start()
 {
     aiCharControl = GetComponent<AICharacterControl>();
     aiCharControl.target = (wanderPoints[Random.Range(0, wanderPoints.Length)].transform.position);
 }
 public override void TalkTo(AICharacterControl context)
 {
     //maybe add a joke answer
 }
 public override void Abandon(AICharacterControl context)
 {
     context.SetState(new AICharacterStateDead());
     context.IsDead = true;
 }
 public virtual void TalkTo(AICharacterControl context)
 {
 }
Example #44
0
 void Start()
 {
     m_AICharacterControl = GetComponent<AICharacterControl>();
     m_character = GetComponent<ThirdPersonCharacter>();
 }
 public virtual void Abandon(AICharacterControl context)
 {
 }
 public override void Heal(AICharacterControl context)
 {
     context.SetState(new AICharacterStateFollow());
 }
 // Use this for initialization
 void Start()
 {
     characterControl = this.GetComponent<AICharacterControl> ();
     // where the player is
     playerTransform = GameObject.FindGameObjectWithTag ("Player").transform;
     enemyTransform = GetComponent<Transform> ();
     areWeFollowingPlayer = false;
     shootableMask = LayerMask.GetMask ("Shootable");
     setInitialCheckpointAndPosition ();
     // to start our cop on his patrol
     continuePatrol();
 }
 public virtual void Blind(AICharacterControl context)
 {
 }
 public virtual void Scare(AICharacterControl context)
 {
 }
 void Start()
 {
     characterControl = GetComponent<AICharacterControl>();
 }
 public virtual void Heal(AICharacterControl context)
 {
 }
 public virtual void Injure(AICharacterControl context)
 {
 }
 public override void Injure(AICharacterControl context)
 {
     context.SetState(new AICharacterStateStand());
     context.playerController.Tell("Kelly", "This...thing hit me! I'm not feeling well...");
     context.IsInjured = true;
 }