コード例 #1
0
 // Use this for initialization
 void Start()
 {
     player             = GameObject.FindGameObjectWithTag("Player");
     aiCharacterControl = GetComponent <AICharacterControl> ();
     animator           = GetComponent <Animator>();
     //OverrideAnimatorController ();
 }
コード例 #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);
            }
        }
コード例 #3
0
 void Start()
 {
     aiCharacterControl     = GetComponent <AICharacterControl>();
     player                 = GameObject.FindGameObjectWithTag("Player");
     startLocation          = new GameObject("EnemyStart").GetComponent <Transform>();
     startLocation.position = transform.position;
 }
コード例 #4
0
ファイル: Fireman.cs プロジェクト: WookieRS/Gas-station
 void Start()
 {
     alarms             = GameObject.FindObjectOfType <Alarms>().GetComponent <Alarms>();
     firemanInventory   = GetComponent <Inventory>();
     aiCharacterControl = GetComponent <AICharacterControl>();
     CheckExtinguisher();
 }
コード例 #5
0
    void Start()
    {
        aiCharacterController = GetComponent <AICharacterControl> ();
        SetPlayers();

        InvokeRepeating("CmdSetTarget", 1, 0.2f);
    }
コード例 #6
0
 private void Awake()
 {
     if (characterControl == null)
     {
         characterControl = GetComponentInChildren <AICharacterControl>();
     }
 }
コード例 #7
0
ファイル: enemyAI.cs プロジェクト: sungear/MiseEnAnxiety
 // Use this for initialization
 void Start()
 {
     player            = GameObject.Find("Player");
     controller        = GetComponent <AICharacterControl>();
     controller.target = SelectDestination();
     currentWp         = controller.target;
 }
コード例 #8
0
 public void togglePause()
 {
     HeroMain.togglePause();
     AICharacterControl.togglePause();
     AIBossCharacterControl.togglePause();
     ThirdPersonUserControl.togglePause();
 }
コード例 #9
0
 void Start()
 {
     thirdPersonCharacter = GetComponent <ThirdPersonCharacter>();
     aICharacterControl   = GetComponent <AICharacterControl>();
     player           = GameObject.FindGameObjectWithTag("Player");
     startingLocation = transform.position;
 }
コード例 #10
0
 // Use this for initialization
 void Start()
 {
     aiCharacter = GetComponent <AICharacterControl>();
     anim        = GetComponent <Animator>();
     player      = GameObject.FindGameObjectWithTag("Player");
     currentHP   = maxHP;
 }
コード例 #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>();
    }
コード例 #12
0
ファイル: Patrol.cs プロジェクト: shopping-rush/shopping-rush
 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);
            }
        }
    }
コード例 #14
0
 public override void TalkTo(AICharacterControl context)
 {
     if (!context.IsDead)
         context.IsScared = false;
         context.moveState = MoveState.Follow;
         context.SetState(new AICharacterStateFollow());
 }
コード例 #15
0
ファイル: Enemy.cs プロジェクト: BalazsKozma92/3rdPersonRPG
    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> ();
    }
コード例 #16
0
 private void Awake()
 {
     navMesh            = GetComponent <NavMeshAgent>();
     aICharacterControl = GetComponent <AICharacterControl>();
     estados            = GetComponent <ControladorIA.Estados>();
     projectil          = GetComponent <ProjectilScript>();
 }
コード例 #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;
 }
コード例 #18
0
ファイル: Enemy.cs プロジェクト: eschafir/Minimal-RPG
 void Start()
 {
     healthBar          = GetComponentInChildren <EnemyHealthBar>();
     currentHealth      = maxHealthPoints;
     aiCharacterControl = GetComponent <AICharacterControl>();
     player             = GameObject.FindGameObjectWithTag("Player");
 }
コード例 #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;
    }
コード例 #20
0
// -- Game loops

        void Start()
        {
            _aiController          = GetComponent <AICharacterControl>();
            _moveTarget            = new GameObject("Player Move Target");
            _meleeAttackController = GetComponent <MeleeWeaponAttack>();
            Camera.main.GetComponent <CameraRaycaster>()._notifyMouseClicked += ProcessMouseClick;
        }
コード例 #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();
        }
    }
コード例 #22
0
ファイル: AIPathSelector.cs プロジェクト: VanDavv/IT-Labs
 // Start is called before the first frame update
 void Start()
 {
     aiControl = GetComponent <AICharacterControl>();
     if (aiControl.target == null)
     {
         UpdateTarget();
     }
 }
コード例 #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);
 }
コード例 #24
0
ファイル: Follower.cs プロジェクト: wrighp/EGD3
    // 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);
    }
コード例 #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;
 }
コード例 #26
0
 void Start()
 {
     Health          = HealthMax;
     ThePlayer       = GameObject.FindGameObjectWithTag("Player");
     ThePlayerScript = ThePlayer.GetComponent <Player>();
     AIControl       = GetComponent <AICharacterControl>();
     HealTimer       = new Timer(HealCooldown);
 }
コード例 #27
0
        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);
        }
コード例 #28
0
    private void MoveToDestination(Vector3 _destination)
    {
        AICharacterControl AIController = GetComponent <AICharacterControl>();

        AIController.SetTarget(_destination);

        //m_navMeshAgent.SetDestination(_destination);
    }
コード例 #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
 }
コード例 #30
0
ファイル: CashBox.cs プロジェクト: WookieRS/Gas-station
    IEnumerator MoveBuyerOnce(AICharacterControl buyerAI, float delayTime)
    {
        yield return(new WaitForSeconds(delayTime));

        buyerAI.agent.stoppingDistance = 0.1f;
        buyerAI.agent.speed            = 0.2f;
        buyerAI.StepForward(1f);
    }
コード例 #31
0
ファイル: Enemy.cs プロジェクト: kijprivate/RPG
 private void Start()
 {
     player                   = GameObject.FindGameObjectWithTag("Player");
     aiCharacterControl       = GetComponent <AICharacterControl>();
     nmAgent                  = GetComponent <NavMeshAgent>();
     nmAgent.stoppingDistance = attackRadius;
     currentHealthPoints      = maxHealthPoints;
 }
コード例 #32
0
 private void Start()
 {
     cameraRaycaster    = Camera.main.GetComponent <CameraRaycaster>();
     m_Character        = GetComponent <ThirdPersonCharacter>();
     currentClickTarget = transform.position;
     aICharacterControl = GetComponent <AICharacterControl>();
     walkTarget         = new GameObject("walkTarget");
 }
コード例 #33
0
ファイル: DemonController.cs プロジェクト: dvera2/LightAbate
 void Awake()
 {
     if(_animator == null)
         _animator = GetComponent<Animator>();
     
     _aiController = GetComponent<AICharacterControl>();
     _thirdPersonController = GetComponent<ThirdPersonCharacter>();
     _characterController = GetComponent<CharacterController>();
 }
コード例 #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;
 }
コード例 #35
0
ファイル: IABehavior.cs プロジェクト: bergerbo/ggj2016
    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());
    }
コード例 #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>();
    }
コード例 #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--;
            }
        }
    }
コード例 #38
0
ファイル: SwitchPlayer.cs プロジェクト: surgeman/Rags-Reason
    /*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)");
    }
コード例 #39
0
ファイル: Player.cs プロジェクト: ASchvartzman/518Project-ASK
        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;
        }
コード例 #40
0
 // Use this for initialization
 void Start()
 {
     aiCharControl = GetComponent<AICharacterControl>();
     aiCharControl.target = (wanderPoints[Random.Range(0, wanderPoints.Length)].transform.position);
 }
コード例 #41
0
 public override void TalkTo(AICharacterControl context)
 {
     //maybe add a joke answer
 }
コード例 #42
0
 public override void Abandon(AICharacterControl context)
 {
     context.SetState(new AICharacterStateDead());
     context.IsDead = true;
 }
コード例 #43
0
 public virtual void TalkTo(AICharacterControl context)
 {
 }
コード例 #44
0
 void Start()
 {
     m_AICharacterControl = GetComponent<AICharacterControl>();
     m_character = GetComponent<ThirdPersonCharacter>();
 }
コード例 #45
0
 public virtual void Abandon(AICharacterControl context)
 {
 }
コード例 #46
0
 public override void Heal(AICharacterControl context)
 {
     context.SetState(new AICharacterStateFollow());
 }
コード例 #47
0
 // 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();
 }
コード例 #48
0
 public virtual void Blind(AICharacterControl context)
 {
 }
コード例 #49
0
 public virtual void Scare(AICharacterControl context)
 {
 }
コード例 #50
0
 void Start()
 {
     characterControl = GetComponent<AICharacterControl>();
 }
コード例 #51
0
 public virtual void Heal(AICharacterControl context)
 {
 }
コード例 #52
0
 public virtual void Injure(AICharacterControl context)
 {
 }
コード例 #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;
 }