void Awake()
 {
     _player = GetComponent<Player> ();
     _aiPlayer = GetComponent<AIPlayer> ();
     _aiMovement = GetComponent<AIMovement> ();
     _movement = GetComponent<PlatformerMovement> ();
 }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     menu       = GameObject.Find("UI_Shop");
     shopSystem = menu.GetComponent <ShopSystem>();
     anim       = GetComponent <Animator>();
     AIMove     = GetComponent <AIMovement>();
 }
Example #3
0
    protected void Start()
    {
        rigidbody = GetComponent <Rigidbody>();
        movement  = GetComponent <AIMovement>();

        movement.Register(AIMovementPriority.FollowingMovement, this);
    }
 private void Start()
 {
     aimScript           = GetComponent <AIMovement>();
     destinationPoint[0] = GetComponent <Transform>();
     randomPoint         = Random.Range(0, destinationPoint.Length);
     stallTime           = initialStallTime;
 }
Example #5
0
 void Start()
 {
     anim             = GetComponent <Animator> ();
     move             = GetComponent <AIMovement> ();
     fireTime         = Time.time;
     arrowPower.value = 0;
 }
Example #6
0
    void Start()
    {
        ai   = GetComponent <AIMovement>();
        anim = GetComponent <Animator>();

        BaseSpeed = ai.speed;
    }
Example #7
0
    public override Type Tick()
    {
        if (movement.currentTarget)
        {
            return(typeof(AttackState));
        }

        if (movement.ReachedDestination())
        {
            if (walking)
            {
                walking  = false;
                nextWalk = Time.time + waitTime.GenerateRandom();
            }
            else if (nextWalk < Time.time)
            {
                walking           = true;
                movement.useSpeed = 0.6f;
                movement.agent.SetDestination(
                    AIMovement.RandomNavSphere(
                        movement.transform.position,
                        walkRange.GenerateRandom(),
                        -1));
            }
        }

        return(GetType());
    }
Example #8
0
    private IEnumerator RotateAI(Direction newFacingDirection)
    {
        if (newFacingDirection != facingDirection)
        {
            switch (newFacingDirection)
            {
            case Direction.Front:
                yield return(StartCoroutine(AIMovement.Rotate(this.transform, 0, new Vector3(0, 1, 0), 0.3f)));

                break;

            case Direction.Left:
                yield return(StartCoroutine(AIMovement.Rotate(this.transform, -90, new Vector3(0, 1, 0), 0.3f)));

                break;

            case Direction.Right:
                yield return(StartCoroutine(AIMovement.Rotate(this.transform, 90, new Vector3(0, 1, 0), 0.3f)));

                break;

            case Direction.Back:
                yield return(StartCoroutine(AIMovement.Rotate(this.transform, 180, new Vector3(0, 1, 0), 0.3f)));

                break;
            }

            this.facingDirection = newFacingDirection;
        }
    }
        public override void Update(GameTime gametime)
        {
            walkingAnimationTimer += (float)gametime.ElapsedGameTime.TotalMilliseconds;
            hitAnimationTimer     += (float)gametime.ElapsedGameTime.TotalMilliseconds;
            if (alive)
            {
                this.sourceRectangle    = new Rectangle(WIDTH * WalkingFrame, 0, WIDTH, HEIGHT);
                this.hitSourceRectangle = new Rectangle(WIDTH * HitFrame, 80, WIDTH, HEIGHT);

                if (Vector2.Distance(this.Position, targetPosition) <= 50)
                {
                    this.velocity = Vector2.Zero;
                    this.Position = new Vector2(0, 0);
                }
                else
                {
                    this.velocity = AIMovement.MoveTowards(this.Position, targetPosition) * SPEED * (float)gametime.ElapsedGameTime.TotalMilliseconds;
                    UpdateRotation();
                    WalkingAnimation(ref walkingAnimationTimer);
                    HitAmimation(ref hitAnimationTimer);
                }

                if (this.health <= 0)
                {
                    Alive = false;
                }
                this.Position     += velocity;
                this.bloodPosition = position;

                //HIT POINT FLASH DISPLAY
                this.damagePosition = new Vector2(this.BoundingBox.X + randomDamageOffset, this.BoundingBox.Y + damageDisplayIncretment);
                if (displayingDamagePoints)
                {
                    damageDisplayIncretment -= 2f;
                    if (damageDisplayIncretment < -100f)
                    {
                        displayingDamagePoints  = false;
                        damageDisplayIncretment = 0f;
                    }
                }
                // HIT POINT FLASH DISPLAY

                ZombieGroan(gametime);
            }
            else if (!alive)
            {
                DeathAnmationTimer -= (float)gametime.ElapsedGameTime.TotalMilliseconds;
                if (DeathAnmationTimer <= 0)
                {
                    DeathFrame++;
                    DeathAnmationTimer = 50f;
                }

                if (DeathFrame >= 11)
                {
                    DeathFrame = 11;
                }
            }
        }
 public FrogMoveState(GameObject npc, float timeBetweenJumps)
 {
     stateID               = StateID.FrogMoving;
     npcController         = npc.GetComponent <NPCController>();
     aiMovement            = npc.GetComponent <AIMovement>();
     this.timeBetweenJumps = timeBetweenJumps;
     timeBetweenJumpsLeft  = 0f;
 }
    protected void Start()
    {
        rigidbody      = GetComponent <Rigidbody>();
        movement       = GetComponent <AIMovement>();
        targetRotation = transform.rotation;

        movement.Register(AIMovementPriority.TrackingMovement, this);
    }
Example #12
0
 public void Init(Craft craft, IOwner owner = null)
 {
     this.owner = owner;
     this.craft = craft;
     movement   = new AIMovement(this);
     movement.SetMoveTarget(craft.transform.position);
     abilityControl = new AIAbilityController(this);
 }
    void Awake()
    {
        // Class

        m_AIHealth   = GetComponent <AIHealth> ();
        m_Animator   = GetComponent <Animator> ();
        m_AIMovement = GetComponent <AIMovement> ();
    }
Example #14
0
 private void Awake()
 {
     movement = GetComponent <AIMovement>();
     nameTag  = GetComponentInChildren <TMP_Text>();
     obstacle = GetComponent <NavMeshObstacle>();
     agent    = GetComponent <NavMeshAgent>();
     Name     = displayName;
 }
Example #15
0
 private void Start()
 {
     agent          = GetComponent <UnityEngine.AI.NavMeshAgent>();
     locomotion     = GetComponent <AIMovement>();
     anim           = GetComponent <Animator>();
     playerAnimator = player.GetComponent <Animator>();
     //movingCubeScript = movingWaypoint.GetComponent<MovingCubeScript>();
 }
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Lumberjack")
     {
         aiScript = collision.gameObject.GetComponent <AIMovement>();
         aiScript.TakeDamage(damage);
     }
 }
Example #17
0
 public AISharedContext()
 {
     AIMapHelper     = new AIMapHelper();
     AIMovement      = new AIMovement();
     AIWeapon        = new AIWeapon();
     AIItemDetection = new AIItemDetection();
     AIInformation   = new AIInformation();
 }
    IEnumerator StartSequenceHiders()
    {
        playerObject1.BlockMovement();
        playerObject2.BlockMovement();
        foreach (GameObject AI in GameObject.FindGameObjectsWithTag("NPC"))
        {
            AIMove = AI.GetComponent <AIMovement>();
            AIMove.BlockMovement();
        }
        //AIMove.BlockMovement();
        hunterLookScreen.SetActive(true);
        yield return(new WaitForSeconds(2));

        vampireAwayMessage.SetActive(true);
        yield return(new WaitForSeconds(4));

        vampireAwayMessage.SetActive(false);
        hunterLocationMessage.SetActive(true);
        yield return(new WaitForSeconds(4));

        hunterLookScreen.SetActive(false);
        playerObject1.DisplayRing();
        yield return(new WaitForSeconds(4));

        vampireLookScreen.SetActive(true);
        hunterAwayMessage.SetActive(true);
        yield return(new WaitForSeconds(4));

        hunterAwayMessage.SetActive(false);
        vampireLocationMessage.SetActive(true);
        yield return(new WaitForSeconds(4));

        vampireLookScreen.SetActive(false);
        playerObject2.DisplayRing();
        yield return(new WaitForSeconds(4));

        countdownScreen.SetActive(true);
        count3.SetActive(true);
        yield return(new WaitForSeconds(1));

        count2.SetActive(true);
        count3.SetActive(false);
        yield return(new WaitForSeconds(1));

        count1.SetActive(true);
        count2.SetActive(false);
        yield return(new WaitForSeconds(1));

        countdownScreen.SetActive(false);
        playerObject1.AllowMovement();
        playerObject2.AllowMovement();
        foreach (GameObject AI in GameObject.FindGameObjectsWithTag("NPC"))
        {
            AIMove = AI.GetComponent <AIMovement>();
            AIMove.AllowMovement();
        }
        countDown.StartCounting();
    }
Example #19
0
 // Use this for initialization
 void Start()
 {
     player.HiderTagged += HiderTagged;
     for (int i = 0; i < totalNumHiders; i++)
     {
         AIMovement copy = Instantiate(hider, transform.position, Quaternion.identity) as AIMovement;
         copy.Setup(hidingSpots, player.gameObject);
     }
 }
Example #20
0
 // Use this for initialization
 void Start()
 {
     aiClass    = GetComponent <AIClass>();
     aiFight    = GetComponent <AIFight>();
     aiMovement = GetComponent <AIMovement>();
     aiInteract = GetComponent <AIInteract>();
     CheckJob();
     GameController.gameController.questControl.GenerateQuest(job, this);
 }
 void Awake()
 {
     playerInfo          = new PlayerInfo(gameObject.name, 0);
     aIMovement          = GetComponent <AIMovement>();
     characterAnimation  = GetComponent <CharacterAnimation>();
     characterController = GetComponent <CharacterController>();
     characterCollider   = GetComponent <CharacterCollider>();
     aIController        = GetComponent <AIController>();
 }
 public PatrolState(Vector3[] waypoints, GameObject npc)
 {
     this.waypoints = waypoints;
     waypointMax    = waypoints.Length;
     waypointIndex  = 0;
     destination    = waypoints[waypointIndex];
     aiMovement     = npc.GetComponent <AIMovement>();
     stateID        = StateID.Patrolling;
 }
Example #23
0
    protected override void Start()
    {
        base.Start();

        Health     = 1000f;
        aiMovement = GetComponent <AIMovement>();

        MakeFSM();
    }
Example #24
0
    private void TestForMovement()
    {
        AIMovement ai = GetComponent <AIMovement>();

        if (ai != null)
        {
            ai.Toggle();
        }
    }
Example #25
0
    public void AllowMovement()
    {
        AIMovement garbageMan = GetComponentInParent <AIMovement>();

        if (garbageMan)
        {
            garbageMan.AllowMovement();
        }
    }
Example #26
0
 // Use this for initialization
 void Start()
 {
     notificationToken = EventAggregator.SingletionAggregator.Subscribe <MovementNotification>(this.processPosition);
     animator          = GetComponent <Animator>();
     goblinSounds      = GetComponents <AudioSource>();
     movement          = GetComponent <AIMovement>();
     deathSound        = goblinSounds[0];
     painSound         = goblinSounds[1];
 }
Example #27
0
    // Use this for initialization
    void Start()
    {
        AIMovement mov = GetComponent <AIMovement>();

        if (mov == null)
        {
            Debugger.LogError("AIMovement not found");
            InitializationError = true;
        }
    }
Example #28
0
    // Update is called once per frame
    void Update()
    {
        AIMovement script = gameObject.GetComponentInParent <AIMovement>();

        if (script)
        {
            radius = gameObject.GetComponentInParent <AIMovement>().evadeRadius;
        }
        CreatePoints();
    }
Example #29
0
    void Start()
    {
        player = GameObject.FindWithTag("Player");
        if (player != null)
        {
            health = player.GetComponent <Health>();
        }

        mov = GetComponent <AIMovement>();
    }
Example #30
0
    void Start()
    {
        GridParent   = GameObject.Find("Grid");
        MainMovement = GetComponent <AIMovement>();
        var GridSize = GridParent.GetComponent <CreateGrid>().GridSized();

        Grid   = new GameObject[(int)GridSize.x, (int)GridSize.y];
        Grid   = GridParent.GetComponent <CreateGrid>().SettingGrid();
        Player = GameObject.FindGameObjectWithTag("Player");
    }
Example #31
0
    private void WanderSetUp()
    {
        AIMovementDelegate = Wander;

        m_agent.autoBraking = false;

        string log = "Tank " + m_PlayerNumber + " is a Wanderer";

        Debug.Log(log);
    }
Example #32
0
    // Use this for initialization
    void Start()
    {
        _player = GetComponent<Player> ();

        _AISystem = GameObject.FindGameObjectWithTag (Tags.GAMECONTROLLER).GetComponent<AISystemManager> ();

        _grid = new Grid (_AISystem.prefabGridList);

        _movement = gameObject.AddComponent<AIMovement> ();
        _combat = gameObject.AddComponent<AICombat> ();
        _targetLocator = gameObject.AddComponent<AITargetPrioritizer> ();

        _movement.SetLevelGrid (_grid);
    }
 // Use this for initialization
 void Start()
 {
     zombie = GetComponent<enemy> ();
     movement = GetComponent<AIMovement> ();
     canvas.gameObject.SetActive (false);
 }
Example #34
0
 void OnAIMovementChange(AIMovement.MovementType oldType, AIMovement.MovementType newType)
 {
     if (newType == AIMovement.MovementType.knockBack)
     {
         anim.SetTrigger("KnockbackOn");
     }
     else if (oldType == AIMovement.MovementType.knockBack)
     {
         anim.SetTrigger("KnockbackOff");
     }
 }