예제 #1
0
    private void Start()
    {
        photonview = this.transform.GetChild(0).GetComponent <PhotonView>();

        PlayerObj.SetActive(true);
        //rvocontroller = GetComponentInChildren<Pathfinding.RVO.RVOController>();
        seeker             = GetComponentInChildren <Pathfinding.Seeker>();
        aipath             = GetComponentInChildren <Pathfinding.AIPath>();
        funnelmodifier     = GetComponentInChildren <Pathfinding.FunnelModifier>();
        aidestinatonsetter = GetComponentInChildren <Pathfinding.AIDestinationSetter>();
        playermouse        = GetComponentInChildren <PlayerMouse>();
        rigidbody          = GetComponentInChildren <Rigidbody>();
        WarFog             = PlayerObj.GetComponent <FogOfWarEntity>();
        forminimap         = transform.GetChild(2).gameObject;
        astar_target       = transform.GetChild(1).gameObject;
        splatmanager       = transform.GetChild(0).GetChild(0).gameObject;

        rigidbody.isKinematic = true;
        WarFog.enabled        = false;

        if (photonView.isMine)
        {
            PlayerObj.name = gameObject.name + "_" + PhotonNetwork.player.NickName;
        }
        else
        {
            PlayerObj.name = gameObject.name + photonView.owner.NickName;
        }

        SceneManager.activeSceneChanged += SceneLoaded;

        DontDestroyOnLoad(this);
    }
예제 #2
0
 void Awake()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent <PlayerMovement>();
     enemy        = GameObject.FindGameObjectWithTag("Enemy");
     canmove      = enemy.GetComponent <Pathfinding.AIPath>();
 }
예제 #3
0
    public override void Initialize()
    {
        aiMoveScript         = GetComponent <Pathfinding.AIPath>();
        playerObject         = HeroGeneralManager.instance.heroObject;
        attackCollider       = transform.GetChild(1).gameObject;
        attackColliderScript = attackCollider.GetComponent <BoxCollider2D>();
        myMeleeAttackRange   = transform.GetChild(3).gameObject;
        //mySkill1AttackRange = transform.GetChild(4).gameObject;
        myAnimator = GetComponent <Animator>();

        myBase = GetComponent <MonsterBase>();
        if (myBase == null)
        {
            Debug.LogError("myBase is null.");
        }

        myDataSet     = MonsterDataManager.instance.ThrowDataIntoContainer((int)MonsterDataManager.MONSTER.FIRE_ELEMENTAL);
        myColliderSet = CSVReader.Read("CSV/Monster/Stage3/ReturnHero_fire_AttackCollider");

        _id                   = (int)myDataSet["ID"];
        _health               = (int)myDataSet["Health"];
        _movingSpeed          = (float)myDataSet["MovingSpeed"];
        aiMoveScript.maxSpeed = _movingSpeed;

        _meleeDamage   = (int)myDataSet["MeleeDamage"];
        _meleeCoolDown = (int)myDataSet["MeleeCoolDown"];

        _skill1Damage   = (int)myDataSet["Skill1Damage"];
        _Skill1CoolDown = (int)myDataSet["Skill1CoolDown"];


        _isMeleeAttackReady  = true;
        _isSkill1AttackReady = false;
        StartCoroutine(CoolDownSkill1());
    }
예제 #4
0
    public override void Initialize()
    {
        aiMoveScript               = GetComponent <Pathfinding.AIPath>();
        playerObject               = HeroGeneralManager.instance.heroObject;
        attackCollider             = transform.GetChild(1).gameObject;
        attackColliderScript       = attackCollider.GetComponent <BoxCollider2D>();
        myMeleeAttackRange         = transform.GetChild(3).gameObject;
        myAnimator                 = GetComponent <Animator>();
        aiDestinationSetter        = GetComponent <Pathfinding.AIDestinationSetter>();
        aiDestinationSetter.target = playerObject.transform;

        myBase = GetComponent <MonsterBase>();
        if (myBase == null)
        {
            Debug.LogError("myBase is null");
        }
        myDataSet     = MonsterDataManager.instance.ThrowDataIntoContainer((int)MonsterDataManager.MONSTER.ZOMBIE);
        myColliderSet = CSVReader.Read("CSV/Monster/Stage1/ReturnHero_Zombie_AttackCollider");


        _id          = (int)myDataSet["ID"];
        _health      = (int)myDataSet["Health"];
        _movingSpeed = (float)myDataSet["MovingSpeed"];

        _meleeDamage   = (int)myDataSet["MeleeDamage"];
        _meleeCoolDown = (int)myDataSet["MeleeCoolDown"];

        _isMeleeAttackReady = true;

        //Debug.Log("Initialized : " + _id + ", " + _health + ", " + _movingSpeed + ", " + _meleeDamage + ", " + _meleeCoolDown);

        //aiMoveScript.maxSpeed = _movingSpeed;
    }
예제 #5
0
    private void Start()
    {
        mybehav     = GetComponent <ChampionBehavior>();
        Spell_D     = PlayerData.Instance.spell_D;
        Spell_F     = PlayerData.Instance.spell_F;
        ChampData   = GetComponent <ChampionData>();
        Player      = GameObject.FindGameObjectWithTag("Player");
        AstarTarget = GameObject.FindGameObjectWithTag("PlayerA*Target");
        if (!Player)
        {
            Player = GameObject.FindGameObjectWithTag("Player");
            if (!Player)
            {
                return;
            }
        }

        team         = PhotonNetwork.player.GetTeam().ToString().ToLower();
        photonview   = GetComponent <PhotonView>();
        aiPath       = GetComponent <Pathfinding.AIPath>();
        splatmanager = GetComponentInChildren <SplatManager>();
        AIPath       = GetComponent <Pathfinding.AIPath>();

        curSpeed = aiPath.maxSpeed;

        layerMask = (-1) - ((1 << LayerMask.NameToLayer("WallCollider")));
        op        = new RaiseEventOptions()
        {
            Receivers = ReceiverGroup.All,
        };
    }
예제 #6
0
    public override void Initialize()
    {
        aiMoveScript = GetComponent <Pathfinding.AIPath>();
        playerObject = HeroGeneralManager.instance.heroObject;
        myAnimator   = GetComponent <Animator>();

        myBase = GetComponent <MonsterBase>();
        if (myBase == null)
        {
            Debug.LogError("myBase is null.");
        }

        myDataSet = MonsterDataManager.instance.ThrowDataIntoContainer((int)MonsterDataManager.MONSTER.ICE_ELEMENTAL);


        _id                   = (int)myDataSet["ID"];
        _health               = (int)myDataSet["Health"];
        _movingSpeed          = (float)myDataSet["MovingSpeed"];
        aiMoveScript.maxSpeed = _movingSpeed;

        _meleeDamage   = (int)myDataSet["MeleeDamage"];
        _meleeCoolDown = (int)myDataSet["MeleeCoolDown"];

        _skill1Damage   = (int)myDataSet["Skill1Damage"];
        _Skill1CoolDown = (int)myDataSet["Skill1CoolDown"];


        _isMeleeAttackReady  = true;
        _isSkill1AttackReady = true;
    }
예제 #7
0
    // Use this for initialization
    void Start()
    {
        rigidBody = GetComponent <Rigidbody>();
        seeker    = GetComponent <Pathfinding.AIPath>();
        StartCoroutine(UpdateTargets());

        animator = GetComponentInChildren <Animator>();
    }
예제 #8
0
    private void Start()
    {
        bat_Animation = GetComponent <Animator>();
        AnimatorStateInfo state = bat_Animation.GetCurrentAnimatorStateInfo(0);

        bat_Animation.Play(state.fullPathHash, -1, Random.Range(0f, 1f));
        ai_path = GetComponentInParent <Pathfinding.AIPath>();
    }
예제 #9
0
 private void Awake()
 {
     aiPathStatus       = gameObject.GetComponent <Pathfinding.AIPath>();
     positionConstraint = gameObject.GetComponent <PositionConstraint>();
     rigidbody          = gameObject.GetComponent <Rigidbody>();
     monsterControl     = GameObject.Find("GameManager").GetComponent <MonsterControl>();
     HookObj            = GameObject.Find("Hook").gameObject;
 }
예제 #10
0
 void OnEnable()
 {
     reachedEnd              = false;
     rigidBody               = GetComponent <Rigidbody>();
     seeker                  = GetComponent <Pathfinding.AIPath>();
     explosionSprite         = transform.FindChild("Explosion").gameObject.GetComponent <SpriteRenderer>();
     explosionSprite.enabled = false;
     health                  = 3;
     SetTargets();
 }
예제 #11
0
 // Use this for initialization
 void Start()
 {
     thisVolcano        = gameObject.GetComponent <MiniVolcanoes>();
     lavaSpriteRenderer = lava.GetComponent <SpriteRenderer>();
     randomLavaTime     = Random.Range(minInvoke, maxInvoke);
     magmaParticle      = gameObject.GetComponentInChildren <ParticleSystem>();
     player             = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>();
     aiPath             = gameObject.GetComponent <Pathfinding.AIPath>();
     aiSetter           = gameObject.GetComponent <Pathfinding.AIDestinationSetter>();
     thirdBossRef       = gameObject.GetComponent <ThirdBossSM>();
     animController     = gameObject.GetComponentInChildren <Animator>();
     //animController.Play()
 }
    private void Awake()
    {
        Enemy_AI = GetComponent <Pathfinding.AIPath>();
        HealthBar_UI.InitializeHealth(health);
        Random_X_Velocity = Mathf.Sign(Random.Range(-1f, 1f)) * Random.RandomRange(0.1f, 2f);        // random direction and magnitude.

        Rat_Anim = GetComponent <Animator>();
        if (Gigantamax)
        {
            Target      = GetComponent <Pathfinding.AIDestinationSetter>();
            totalHealth = health;
        }
    }
예제 #13
0
    // Start is called before the first frame update
    void Start()
    {
        playerCrowScript       = GameObject.FindWithTag("Player").GetComponent <Player_to_Crow>();
        targetingScript        = GetComponentInParent <Pathfinding.AIDestinationSetter>();
        targetingScript.target = playerCrowScript.returnCrowTarget1();

        crowParent.transform.position = playerCrowScript.returnCrowTarget1().position;

        crow_Animation = GetComponent <Animator>();
        AnimatorStateInfo state = crow_Animation.GetCurrentAnimatorStateInfo(0);

        crow_Animation.Play(state.fullPathHash, -1, Random.Range(0f, 1f));
        ai_path = GetComponentInParent <Pathfinding.AIPath>();
    }
    public LookingDirection myLookingDirection;     // Top, Down, Left, Right



    #region MonoBehavior CallBacks

    private void OnEnable()
    {
        // Initialize at here
        myState  = State.Alive;
        myAction = Action.Idle;

        playerObject   = HeroGeneralManager.instance.heroObject;
        aiMoveScript   = GetComponent <Pathfinding.AIPath>();
        attackCollider = transform.GetChild(0).GetComponent <BoxCollider2D>();
        animator       = GetComponent <Animator>();

        //print(playerObject);

        Initialize();

        aiMoveScript.enabled = false;
    }
예제 #15
0
    private void Awake()
    {
        target         = new GameObject("Target");
        rb             = GetComponent <Rigidbody2D>();
        NPCPath        = GetComponent <Pathfinding.AIPath>();
        NPCDestination = GetComponent <Pathfinding.AIDestinationSetter>();
        ghost          = GameObject.Find("Ghost");

        shouts = GetComponents <AudioSource>();

        EventManager.AddListener(EventTypes.RunawayToDoorNew, Runaway);
        EventManager.AddListener(EventTypes.RunawayAnywhere, Investigate);
        //EventManager.AddListener(EventTypes.StopRunaway, RunToDoor);
        EventManager.AddListener(EventTypes.StopRunawayAnywhere, StopInvestigation);
        //EventManager.AddListener(EventTypes.RunToDoor, RunToDoor);
        EventManager.AddListener(EventTypes.Dead, OnDeath);
    }
예제 #16
0
    //private stuff
    public void Awake()
    {
        taskList = new TaskList();

        player      = GameObject.Find("Player").GetComponent <PlayerControl>();
        enemyVision = GetComponent <EnemyVision>();

        pathFinder = GetComponent <Pathfinding.AIPath>();

        //initialize state machines
        mainFSM = new StateMachine(this);

        soundManager = GameObject.Find("Sound Manager").GetComponent <SoundManager>();
        soundFSM     = new StateMachine(this);

        myAwake(); //called from derived class
    }
예제 #17
0
    void Awake()
    {
        base.Awake();
        //initialize child specific variables
        visionRadius = 5f;

        //get references to all attatched hitboxes and set the default
        Hitboxes = new List <BoxCollider2D>();
        Transform[] ts = GetComponentsInChildren <Transform>();
        foreach (Transform t in ts)
        {
            if (t.CompareTag("Hitbox"))
            {
                Hitboxes.Add(t.GetComponent <BoxCollider2D>());
            }
        }

        effectiveHitbox = Hitboxes[0];

        Path = GetComponent <Pathfinding.AIPath>();
        DestinationSetter = GetComponent <Pathfinding.AIDestinationSetter>();
        AIPatrol          = GetComponent <Pathfinding.Patrol>();

        Path.maxSpeed = movementSpeed;

        currentAIState  = AIState.idle;
        previousAIState = AIState.start;

        //TG
        //I am not searching on instantiation
        bIsSearching = false;
        bIsFleeing   = false;
        bIsCounting  = false;

        //Create chase waypoint
        chaseTarget = Instantiate(waypoint, gameObject.transform.position, new Quaternion(), GameObject.Find("waypointListContainer").transform);

        //Create patrol waypoints
        patrolPointArray[0] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x + 5f, gameObject.transform.position.y + 5f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
        patrolPointArray[1] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x + 5f, gameObject.transform.position.y - 5f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
        patrolPointArray[2] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x - 5f, gameObject.transform.position.y + 5f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
        patrolPointArray[3] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x - 5f, gameObject.transform.position.y - 5f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
    }
예제 #18
0
    void Start()
    {
        GameObject temp = Instantiate(new GameObject());

        temp.transform.position = this.transform.position;
        startingPos             = temp.transform;

        SearchTime = giveUpTime;

        line               = this.GetComponent <LineRenderer>();
        player             = GameObject.FindObjectOfType <PlayerManager>();
        line.useWorldSpace = true;
        TimeUntilFiring    = fireRate;
        pathing            = transform.parent.GetComponent <Pathfinding.AIPath>();

        outOfRange = Vector2.Distance(this.transform.position, player.transform.position) < RANGE;

        active = CheckLineOfSight(ACTIVE_RANGE);
    }
예제 #19
0
    public override void Initialize()
    {
        aiMoveScript               = GetComponent <Pathfinding.AIPath>();
        playerObject               = HeroGeneralManager.instance.heroObject;
        attackCollider             = transform.GetChild(1).gameObject;
        attackColliderScript       = attackCollider.GetComponent <BoxCollider2D>();
        myMeleeAttackRange         = transform.GetChild(3).gameObject;
        mySkill1AttackRange        = transform.GetChild(4).gameObject;
        mySkill2AttackRange        = transform.GetChild(5).gameObject;
        myAnimator                 = GetComponent <Animator>();
        aiDestinationSetter        = GetComponent <Pathfinding.AIDestinationSetter>();
        aiDestinationSetter.target = playerObject.transform;

        myBase = GetComponent <MonsterBase>();
        if (myBase == null)
        {
            Debug.LogError("myBase is null.");
        }

        myDataSet     = MonsterDataManager.instance.ThrowDataIntoContainer((int)MonsterDataManager.MONSTER.GATEKEEPER);
        myColliderSet = CSVReader.Read("CSV/Monster/Stage0/ReturnHero_GateKeeper_AttackCollider");


        _id                   = (int)myDataSet["ID"];
        _health               = (int)myDataSet["Health"];
        _movingSpeed          = (float)myDataSet["MovingSpeed"];
        aiMoveScript.maxSpeed = _movingSpeed;

        _meleeDamage   = (int)myDataSet["MeleeDamage"];
        _meleeCoolDown = (int)myDataSet["MeleeCoolDown"];

        _skill1Damage   = (int)myDataSet["Skill1Damage"];
        _Skill1CoolDown = (int)myDataSet["Skill1CoolDown"];

        _skill2Damage   = (int)myDataSet["Skill2Damage"];
        _Skill2CoolDown = (int)myDataSet["Skill2CoolDown"];


        _isMeleeAttackReady  = true;
        _isSkill1AttackReady = true;
        _isSkill2AttackReady = true;
    }
예제 #20
0
    void Start()
    {
        cam             = Camera.main;
        rb              = GetComponent <Rigidbody2D>();
        stats           = GetComponent <BasicStats>();
        headReset       = transform.Find("Head Reset");
        audioManager    = AudioManager.instance;
        animTimeManager = GameManager.instance.GetComponent <AnimTimeManager>();
        gm              = GameManager.instance;
        anim            = GetComponent <Animator>();
        obstacleMask    = LayerMask.GetMask("Walls", "OpenDoors", "ClosedDoors");

        AIDestSetter  = GetComponent <Pathfinding.AIDestinationSetter>();
        AIPath        = GetComponent <Pathfinding.AIPath>();
        RVOController = GetComponent <Pathfinding.RVO.RVOController>();

        CalculateMoveSpeeds();

        StartCoroutine(UpdateFootstepSounds());
    }
예제 #21
0
    void Awake()
    {
        base.Awake();

        baseAttack = 10.0f;

        dexterity     = .05f;
        vitality      = .01f;
        movementSpeed = 6.0f;

        //initialize child specific variables
        visionRadius = 8f;

        Path = GetComponent <Pathfinding.AIPath>();
        DestinationSetter = GetComponent <Pathfinding.AIDestinationSetter>();
        AIPatrol          = GetComponent <Pathfinding.Patrol>();

        Path.maxSpeed = movementSpeed;

        currentAIState  = AIState.idle;
        previousAIState = AIState.start;

        //TG
        //Sets the ray cast to trigger when colliding with player hurtbox
        layerMask = 1 << 10;


        //I am not searching on instantiation
        bIsSearching = false;
        bIsFleeing   = false;
        bIsCounting  = false;

        //Create chase waypoint
        chaseTarget = Instantiate(waypoint, gameObject.transform.position, new Quaternion(), GameObject.Find("waypointListContainer").transform);

        //Create patrol waypoints
        patrolPointArray[0] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x - 5.0f, gameObject.transform.position.y + 5.0f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
        patrolPointArray[1] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x + 5.0f, gameObject.transform.position.y + 5.0f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
        patrolPointArray[2] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x + 5.0f, gameObject.transform.position.y - 5.0f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
        patrolPointArray[3] = Instantiate(waypoint, new Vector3(gameObject.transform.position.x - 5.0f, gameObject.transform.position.y - 5.0f, 0), new Quaternion(), GameObject.Find("waypointListContainer").transform);
    }
예제 #22
0
    void Update()
    {
        if (!startFight)
        {
            SetStart();
        }


        if (!imortal)
        {
            HpManager(); //control and update Hp and stamina variables
            if (!Hunt)
            {
                Pathfinding.AIPath mention = GetComponent <Pathfinding.AIPath>();

                mention.maxSpeed = 15;
            }
            if (Hp <= 0)
            {// control when the cell die
                Dead();
                Debug.Log(this.name + " is Dead");
            }
            // switch between the fuctions
            if (Hunt)
            {
                //Debug.Log("Hunt is on");
                Pathfinding.AIPath mention = GetComponent <Pathfinding.AIPath>();
                mention.maxSpeed = 25;
                HuntFunciton();
            }
            if (Reproduction)
            {
                // Debug.Log("Reproduction is on");
                Reproduce();
            }
            if (heal)
            {
                // Debug.Log("Heal is on");
                Healing();
            }
            if (lastStand)
            {
                //Debug.Log("Last stand is on");
                lastStandFunction();
            }
            if ((!lastStand) && (!heal) && (!Reproduction) && (!Hunt))
            {
                if (MaxStamina > HuntVar)
                {
                    Reproduction = true;
                    Hunt         = false;
                    heal         = false;
                    lastStand    = false;
                    executeOnce  = false;
                    timer        = waitTime;
                }
                else if (HuntVar > MaxStamina)
                {
                    Hunt         = true;
                    Reproduction = false;
                    heal         = false;
                    lastStand    = false;
                    executeOnce  = false;
                    timer        = waitTime;
                }
            }
        }

        if (this.gameObject.tag == "GoodCells")
        {
            if (flockControlGood.GetComponent <Flock>().lastStand)
            {
                lastStand = true;
            }
        }
        if (this.gameObject.tag == "NeutralCells")
        {
            if (flockControlNeutral.GetComponent <Flock>().lastStand)
            {
                lastStand = true;
            }
        }
    }
예제 #23
0
 void Start()
 {
     playerObject = GameObject.FindGameObjectWithTag("Player");
     aiPath       = GetComponent <Pathfinding.AIPath>();
     StartCoroutine("ShootCycle");
 }