当前位置: 首页>>代码示例>>C#>>正文


C# EnemyController类代码示例

本文整理汇总了C#中EnemyController的典型用法代码示例。如果您正苦于以下问题:C# EnemyController类的具体用法?C# EnemyController怎么用?C# EnemyController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EnemyController类属于命名空间,在下文中一共展示了EnemyController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 // Use this for initialization
 public override void Start()
 {
     myRigidBody = GetComponent<Rigidbody2D>();
     enemyController = GetComponent<EnemyController>();
     timeOut = turnDelay;
     base.Start();
 }
开发者ID:thanniaB,项目名称:censor-me,代码行数:8,代码来源:EnemyHornSkullController.cs

示例2: Start

 void Start()
 {
     bandera = true;
     tiempo = Time.time;
     //aux_tiempo = Time.time;
     Parent = gameObject.GetComponentInParent<EnemyController> ();
 }
开发者ID:JavierMijangos,项目名称:VideoJuego,代码行数:7,代码来源:HanzoTrigger.cs

示例3: Shoot

    private void Shoot()
    {
        Ray ray = new Ray(Camera.main.transform.position, Camera.main.transform.forward);
        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo) || !Physics.Raycast(ray, out hitInfo))//wheter we hit something or not shoot
        {
            try {
                Vector3 hitPoint = hitInfo.point;
                Instantiate(bulletPrefab, hitPoint, Quaternion.identity);

                if(bulletPrefab != null)
                {
                    audio.PlayOneShot(shotSound);
                    bullets--;

                    enemy = hitInfo.collider.GetComponent<EnemyController>();
                    if (hitInfo.collider.tag == "Enemy")
                    {
                        enemy.Damage();
                    }
                }
            }
            catch (NullReferenceException e)
            {//if no object is hit
                //do nothing because we want to shoot anyway
            }
        }
    }
开发者ID:AaronFlanagan20,项目名称:Mobile-App-Project,代码行数:29,代码来源:FireGunLevel2.cs

示例4: Awake

 //Rigidbody enemyRigidbody;
 void Awake()
 {
     //enemyRigidbody = GetComponent <Rigidbody> ();
     ec = GetComponent <EnemyController> ();
     anim = GetComponent <Animator> ();
     nav = GetComponent <NavMeshAgent> ();
 }
开发者ID:ray-z,项目名称:RPG,代码行数:8,代码来源:EnemyMovement.cs

示例5: Start

	// Use this for initialization
	void Start () {

		//init
		wallFlag = false;

		maps = new GameObject[NUMBER_OBJ];
		CreateMapOnStart();

		//Find GameController
		gameControllerObj = GameObject.Find ("GameController");
		clt = gameControllerObj.GetComponent <GameController>();
		//Debug.Log ("AAAAAAAAAAAAAAAAAAAAAA: sss" + clt.character.transform.position.x);

		//Find EnemyController
		enemyControllerObj = GameObject.Find ("EnemyController");
		enemyController = enemyControllerObj.GetComponent <EnemyController>();


		mapsPath = new string[NUMBER_MAPS_TYPE];
		mapsPath [0] = "Prefabs/Maps/way";
		mapsPath [1] = "Prefabs/Maps/way_duongreu";
		mapsPath [2] = "Prefabs/Maps/way_ground";
		wallPath = "Prefabs/Maps/wall_easy";
		wallsHardPath = new string[3];
		wallsHardPath [0] = "Prefabs/Maps/wall_hard_left";
		wallsHardPath [1] = "Prefabs/Maps/wall_hard_center";
		wallsHardPath [2] = "Prefabs/Maps/wall_hard_right";

		walls = new List<GameObject> ();

	}
开发者ID:kyo88,项目名称:runner,代码行数:32,代码来源:MapController.cs

示例6: Start

 private void Start()
 {
     if (GameController.Instance.battleType == BattleType.Team && GameController.Instance.isMaster)
     {
         enemyController = TranscriptManager._instance.GetComponent<EnemyController>();
     }
 }
开发者ID:vin120,项目名称:TaiDou,代码行数:7,代码来源:EnemyTrigger.cs

示例7: CalculateCoeficient

 /// <summary>
 /// Calculates the coeficients for scaling
 /// </summary>
 /// <param name="player"></param>
 /// <param name="enemy"></param>
 /// <returns></returns>
 public float CalculateCoeficient(PlayerController player, EnemyController enemy)
 {
     if (player.GetSize() > player.startsize * 2f)
     {
         return coeficient = 0.012f;
     }
     if (player.GetSize() > player.startsize * 4f)
     {
         return coeficient = 0.015f;
     }
     if (player.GetSize() > player.startsize * 6f)
     {
         return coeficient = enemy.GetSize() * 0.016f;
     }
     else
     {
         if (player.GetSize() < player.startsize * 2)
         {
             if (player.GetSize() <= player.startsize * 0.5f)
             {
                 return coeficient = enemy.GetSize() * 0.02f;
             }
             else
             {
                 return coeficient = enemy.GetSize() * 0.025f;
             }
         }
     }
     return coeficient;
 }
开发者ID:Infatum,项目名称:Hungry-Balls,代码行数:36,代码来源:BaseLogic.cs

示例8: FindTarget

    void FindTarget()
    {
        // pick closest enemy
        float smallestDistance = 0;
        EnemyController closest = null;

        foreach (Transform t in Game.EnemyGroup) {
            float distance = (transform.position-t.position).magnitude;
            if (closest == null || distance < smallestDistance) {
                smallestDistance = distance;
                closest = t.GetComponent<EnemyController>();
            }
        }

        if (closest != null && smallestDistance < enemySearchRadius) {
            boidComponent.GetBehaviour("ToPlayer").SetWeight(0);
            boidComponent.GetBehaviour("ToEnemy").SetWeight(1);
            target = closest;
            (boidComponent.GetBehaviour("ToEnemy") as ArrivalBehaviour).targetObject = target.transform;
        }
        else if ((closest == null || smallestDistance > enemySearchRadius) && boidComponent.GetBehaviour("ToEnemy").weight != 0) {
            boidComponent.GetBehaviour("ToEnemy").SetWeight(0);
            boidComponent.GetBehaviour("ToPlayer").SetWeight(1);
        }
    }
开发者ID:90ninecents,项目名称:SWAPPZ-1,代码行数:25,代码来源:CompanionController.cs

示例9: Start

	// Use this for initialization
	void Start () {
		currentCooldownTime = 0;
		envr = GameObject.FindObjectOfType<Environment> ();
		partyController = envr.gameObject.GetComponent<PartyController> ();
		enemyController = envr.gameObject.GetComponent<EnemyController> ();
		mainCamera = Camera.main; 
	}
开发者ID:JackUnthank,项目名称:Portfolio,代码行数:8,代码来源:MouseController.cs

示例10: AppearNext

    /// <summary>
    /// 出現時処理。
    /// </summary>
    public void AppearNext()
    {
        // 次の敵へ
        currentID++;
        var go = Instantiate(enemyObjectBase) as GameObject;
        enemyObject = go.GetComponent<EnemyController>();
        enemyObject.ID = currentID;
        EnemyData data = EnemyData.Get(currentID - 1);
        if (data == null)
        {
            GameManager.Instance().OnAllKilled();
            return;
        }
        enemyObject.HP = data.hp;
        enemyObject.MaxHP = data.hp;
        enemyObject.hpGauge = hpGauge;
        enemyObject.hpGauge.SetPercent(1);
        enemyObject.Appear();
        enemyObject.data = data;
        enemyObject.damageNumber = damageNumber;
        enemyObject.hpGauge.SetElement(data.element);

        Debug.Log("Enemy was appeard.");
        Debug.Log("ID : " + enemyObject.ID);
        Debug.Log("HP : " + enemyObject.HP);
    }
开发者ID:murapong,项目名称:magic-de-pong,代码行数:29,代码来源:EnemyGenerator.cs

示例11: MoveLogic

    public Vector3 MoveLogic(EnemyController enemy, GameObject player)
    {
        if (LMHelper.IsInRange(enemy, player))
        {
            enemy.SetAggroState(true);  //aggroed if within aggro range
            float pm = enemy.GetPrevMvt().magnitude;
            Vector3 mvt;

            // If hitting a wall and moving slowly, take a detour sideways
            // (prevents behavior if out in the open or if it happens to graze a wall while moving rapidly)
            if (enemy.GetWallHit() && pm <= .05)
            {
                Vector3 direct = LMHelper.BaseMoveLogic(enemy, player);              //first get direct approach
                mvt = Vector3.Cross(direct, new Vector3(0f, 1f, 0f));                  //cross with vertical to get left perpendicular

                if (Time.time % 4 <= 0.02)
                {
                    mvt *= -1;                                      //flip direction every 5 seconds
                }

                mvt -= direct * (Random.value - 0.5f);              //take random angle from straight perpendicular
                mvt.Normalize();                                 //re-normalize

            }
            else // otherwise chase as normal
            {
                mvt = LMHelper.BaseMoveLogic(enemy, player);
            }
            return mvt;
        }
        enemy.SetAggroState(false);
        return new Vector3(0f, 0f, 0f);
    }
开发者ID:mattgor123,项目名称:CS355-Robo-Clean-5000,代码行数:33,代码来源:LMDetour.cs

示例12: NewGame

    public static void NewGame()
    {
        auto = false;
        data = new GameData();
        enemyController = new EnemyController();
        ILevelBuilder generator = new LevelGenerator();

        data.level = generator.Generate();
        for (int i = 0; i < data.level.doors.Count; i++)
        {
            data.level.doors[i].Init();
        }

        data.SpawnPlayer();
        //DEBUG STUFF
        //data.inventory.Add(ItemLibrary.Get().items[5], 1);

        foreach (IGameDataChangeListener listener in GAMEDATA_CHANGE_LISTENERS)
        {
            listener.OnGameDataChange(data);
        }

        //ConsolePseudoRaycast.CastRay(new Vector2(14, 1), new Vector2(16, 3));
        //Console.ReadKey();
    }
开发者ID:kevinwegner,项目名称:ConsoleDungeonCrawler,代码行数:25,代码来源:Application.cs

示例13: GoToEnemy

 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 public void GoToEnemy(GameObject enemy)
 {
     if(!_isAttacking){
         _target = enemy.GetComponent<EnemyController>();
         navMeshAgent.SetDestination(enemy.transform.position);
     }
 }
开发者ID:jsr2k1,项目名称:test_social_point,代码行数:8,代码来源:PlayerController.cs

示例14: RealRadiansOfEnemy

 public float RealRadiansOfEnemy(EnemyController ec)
 {
     float degrees = (ec.GetTrackID()-1)*60; //clockwise of y-axis
     degrees += 15*ec.GetTrackLane(); //negative trackpos is left side, positive is right side, 0 is middle
     degrees = ((360-degrees) + 90)%360; //convert to counterclockwise of x axis
     degrees *= Mathf.Deg2Rad;
     return degrees;
 }
开发者ID:Benedict-SC,项目名称:doom-dial,代码行数:8,代码来源:EnemyMover.cs

示例15: KillTarget

 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 IEnumerator KillTarget()
 {
     yield return new WaitForSeconds(0.25f);
     _target.GetComponent<EnemyController>().OnKilled();
     //gameController.OnEnemyKilled(); //Not necessary, using events to reduce coupling
     _isAttacking = false;
     _target = null;
 }
开发者ID:jsr2k1,项目名称:test_social_point,代码行数:9,代码来源:PlayerController.cs


注:本文中的EnemyController类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。