Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     player             = GameObject.FindGameObjectWithTag("Player");
     aiCharacterControl = GetComponent <AICharacterControl> ();
     animator           = GetComponent <Animator>();
     //OverrideAnimatorController ();
 }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 void Start()
 {
     aiCharacterControl     = GetComponent <AICharacterControl>();
     player                 = GameObject.FindGameObjectWithTag("Player");
     startLocation          = new GameObject("EnemyStart").GetComponent <Transform>();
     startLocation.position = transform.position;
 }
Ejemplo n.º 4
0
 void Start()
 {
     alarms             = GameObject.FindObjectOfType <Alarms>().GetComponent <Alarms>();
     firemanInventory   = GetComponent <Inventory>();
     aiCharacterControl = GetComponent <AICharacterControl>();
     CheckExtinguisher();
 }
Ejemplo n.º 5
0
    void Start()
    {
        aiCharacterController = GetComponent <AICharacterControl> ();
        SetPlayers();

        InvokeRepeating("CmdSetTarget", 1, 0.2f);
    }
 private void Awake()
 {
     if (characterControl == null)
     {
         characterControl = GetComponentInChildren <AICharacterControl>();
     }
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     player            = GameObject.Find("Player");
     controller        = GetComponent <AICharacterControl>();
     controller.target = SelectDestination();
     currentWp         = controller.target;
 }
Ejemplo n.º 8
0
 public void togglePause()
 {
     HeroMain.togglePause();
     AICharacterControl.togglePause();
     AIBossCharacterControl.togglePause();
     ThirdPersonUserControl.togglePause();
 }
Ejemplo n.º 9
0
 void Start()
 {
     thirdPersonCharacter = GetComponent <ThirdPersonCharacter>();
     aICharacterControl   = GetComponent <AICharacterControl>();
     player           = GameObject.FindGameObjectWithTag("Player");
     startingLocation = transform.position;
 }
Ejemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     aiCharacter = GetComponent <AICharacterControl>();
     anim        = GetComponent <Animator>();
     player      = GameObject.FindGameObjectWithTag("Player");
     currentHP   = maxHP;
 }
Ejemplo n.º 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>();
    }
Ejemplo n.º 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);
            }
        }
    }
Ejemplo n.º 14
0
 public override void TalkTo(AICharacterControl context)
 {
     if (!context.IsDead)
         context.IsScared = false;
         context.moveState = MoveState.Follow;
         context.SetState(new AICharacterStateFollow());
 }
Ejemplo n.º 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>();
 }
Ejemplo n.º 17
0
 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;
 }
Ejemplo n.º 18
0
 void Start()
 {
     healthBar          = GetComponentInChildren <EnemyHealthBar>();
     currentHealth      = maxHealthPoints;
     aiCharacterControl = GetComponent <AICharacterControl>();
     player             = GameObject.FindGameObjectWithTag("Player");
 }
Ejemplo n.º 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;
    }
Ejemplo n.º 20
0
// -- Game loops

        void Start()
        {
            _aiController          = GetComponent <AICharacterControl>();
            _moveTarget            = new GameObject("Player Move Target");
            _meleeAttackController = GetComponent <MeleeWeaponAttack>();
            Camera.main.GetComponent <CameraRaycaster>()._notifyMouseClicked += ProcessMouseClick;
        }
Ejemplo n.º 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();
        }
    }
Ejemplo n.º 22
0
 // Start is called before the first frame update
 void Start()
 {
     aiControl = GetComponent <AICharacterControl>();
     if (aiControl.target == null)
     {
         UpdateTarget();
     }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
    }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 28
0
    private void MoveToDestination(Vector3 _destination)
    {
        AICharacterControl AIController = GetComponent <AICharacterControl>();

        AIController.SetTarget(_destination);

        //m_navMeshAgent.SetDestination(_destination);
    }
Ejemplo n.º 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
 }
Ejemplo n.º 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);
    }
Ejemplo n.º 31
0
 private void Start()
 {
     player                   = GameObject.FindGameObjectWithTag("Player");
     aiCharacterControl       = GetComponent <AICharacterControl>();
     nmAgent                  = GetComponent <NavMeshAgent>();
     nmAgent.stoppingDistance = attackRadius;
     currentHealthPoints      = maxHealthPoints;
 }
Ejemplo n.º 32
0
 private void Start()
 {
     cameraRaycaster    = Camera.main.GetComponent <CameraRaycaster>();
     m_Character        = GetComponent <ThirdPersonCharacter>();
     currentClickTarget = transform.position;
     aICharacterControl = GetComponent <AICharacterControl>();
     walkTarget         = new GameObject("walkTarget");
 }
Ejemplo n.º 33
0
 void Awake()
 {
     if(_animator == null)
         _animator = GetComponent<Animator>();
     
     _aiController = GetComponent<AICharacterControl>();
     _thirdPersonController = GetComponent<ThirdPersonCharacter>();
     _characterController = GetComponent<CharacterController>();
 }
Ejemplo n.º 34
0
 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;
 }
Ejemplo n.º 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());
    }
Ejemplo n.º 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>();
    }
Ejemplo n.º 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--;
            }
        }
    }
Ejemplo n.º 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)");
    }
Ejemplo n.º 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;
        }
Ejemplo n.º 40
0
 // Use this for initialization
 void Start()
 {
     aiCharControl = GetComponent<AICharacterControl>();
     aiCharControl.target = (wanderPoints[Random.Range(0, wanderPoints.Length)].transform.position);
 }
Ejemplo n.º 41
0
 public override void TalkTo(AICharacterControl context)
 {
     //maybe add a joke answer
 }
Ejemplo n.º 42
0
 public override void Abandon(AICharacterControl context)
 {
     context.SetState(new AICharacterStateDead());
     context.IsDead = true;
 }
Ejemplo n.º 43
0
 public virtual void TalkTo(AICharacterControl context)
 {
 }
Ejemplo n.º 44
0
 void Start()
 {
     m_AICharacterControl = GetComponent<AICharacterControl>();
     m_character = GetComponent<ThirdPersonCharacter>();
 }
Ejemplo n.º 45
0
 public virtual void Abandon(AICharacterControl context)
 {
 }
Ejemplo n.º 46
0
 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();
 }
Ejemplo n.º 48
0
 public virtual void Blind(AICharacterControl context)
 {
 }
Ejemplo n.º 49
0
 public virtual void Scare(AICharacterControl context)
 {
 }
Ejemplo n.º 50
0
 void Start()
 {
     characterControl = GetComponent<AICharacterControl>();
 }
Ejemplo n.º 51
0
 public virtual void Heal(AICharacterControl context)
 {
 }
Ejemplo n.º 52
0
 public virtual void Injure(AICharacterControl context)
 {
 }
Ejemplo n.º 53
0
 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;
 }