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


C# EnemyController.setUp方法代码示例

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


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

示例1: Awake

    void Awake()
    {
        Transform guardProxy = transform.Find("GuardProxy");
        Destroy(guardProxy.gameObject);

        guardObj = Instantiate(guardModel, Vector3.zero, Quaternion.identity) as Transform;
        guardObj.name = "GuardModel";
        guardObj.parent = transform;
        guardObj.localPosition = Vector3.zero;
        guardObj.localRotation = Quaternion.identity;
        RagDollController guardRagDoll = guardObj.gameObject.AddComponent<RagDollController>();

        enemyAnimator = GetComponent<EnemyAnimator>();
        if (!enemyAnimator) Debug.Log("ERROR: Can't Find Enemy Animator");

        enemyController = GetComponent<EnemyController>();
        if (!enemyController) Debug.Log("ERROR: Can't Find Enemy Controller");

        Transform guardRoot = guardObj.Find ("Guard_Skeleton/Root");
        if (!guardRoot) Debug.Log("ERROR: Can't Find Guard Root");
        guardRoot.gameObject.AddComponent<ExplosionCatcher>();

        Transform guardHead = guardObj.Find ("Guard_Skeleton/Root/UpperBody/Spine1/Spine2/Neck/Head");
        if (!guardHead) Debug.Log("ERROR: Can't Find Guard Head");

        Transform guardGun = guardObj.Find ("Guard_Geometry/Guard_Gun");
        if (!guardGun) Debug.Log("ERROR: Can't Find Guard Gun");

        //Transform guardGunHolster = guardObj.Find ("Guard_Geometry/Guard_GunHolster");
        //if (!guardGun) Debug.Log("ERROR: Can't Find Guard Gun Holster");

        Transform guardRightHand = guardObj.Find ("Guard_Skeleton/Root/UpperBody/Spine1/Spine2/RightShoulder/RightElbow/RightWrist");
        if (!guardRightHand) Debug.Log("ERROR: Can't Find Guard Hand");

        Transform guardUpperTorso = guardObj.Find ("Guard_Skeleton/Root/UpperBody/Spine1/Spine2");
        if (!guardUpperTorso) Debug.Log("ERROR: Can't Find Guard Torso");

        Transform guardUpperBody = guardObj.Find ("Guard_Skeleton/Root/UpperBody");
        if (!guardUpperBody) Debug.Log("ERROR: Can't Find Guard UpperBody");

        Transform guardBadge = guardObj.Find ("Guard_Geometry/Guard_Badge");
        if (!guardBadge) Debug.Log("ERROR: Can't Find Guard Badge");

        Transform guardHat = guardObj.Find ("Guard_Geometry/Guard_Hat");
        if (!guardHat) Debug.Log("ERROR: Can't Find Guard Hat");

        Transform[] accessories = new Transform[2];
        accessories[0] = guardBadge;
        accessories[1] = guardHat;

        guardGun.parent = guardRightHand;
        guardBadge.parent = guardUpperTorso;
        guardHat.parent = guardHead;

        enemyAnimator.setUp(guardObj, guardUpperBody);
        enemyController.setUp(guardHead,guardRagDoll, accessories);
        enemyController.addWeapon(guardGun);

        setUpData.layerName = "EnemyRagDoll";
        setUpData.rootTransform = guardRoot;
        setUpData.root.collision.center = new Vector3(0.000f, 0.187f, -0.030f);
        setUpData.root.collision.size = new Vector3(0.507f, 0.575f, 0.305f);

        setUpData.leftHip.collision.center = new Vector3(-0.221f, 0.000f, 0.000f);
        setUpData.leftHip.collision.radius = 0.142f;
        setUpData.leftHip.collision.height = 0.475f;
        setUpData.leftHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftHip.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftKnee.collision.center = new Vector3(-0.35f, 0.000f, 0.000f);
        setUpData.leftKnee.collision.radius = 0.114f;
        setUpData.leftKnee.collision.height = 0.459f;
        setUpData.leftKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.leftKnee.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.rightHip.collision.center = new Vector3(0.237f, 0.000f, 0.000f);
        setUpData.rightHip.collision.radius = 0.142f;
        setUpData.rightHip.collision.height = 0.475f;
        setUpData.rightHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.rightHip.joint.swingAxis = new Vector3(0.0f, 0.0f, -1.0f);

        setUpData.rightKnee.collision.center = new Vector3(0.35f, 0.000f, 0.000f);
        setUpData.rightKnee.collision.radius = 0.114f;
        setUpData.rightKnee.collision.height = 0.459f;
        setUpData.rightKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.rightKnee.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        setUpData.spine.collision.center = new Vector3(-0.160f, -0.005f, -0.000f);
        setUpData.spine.collision.size = new Vector3(0.321f, 0.304f, 0.507f);
        setUpData.spine.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.spine.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.head.collision.center = new Vector3(0.000f, 0.126f, 0.000f);
        setUpData.head.collision.radius = 0.126f;
        setUpData.head.joint.axis = new Vector3(1.0f, 0.0f, 0.0f);
        setUpData.head.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftShoulder.collision.center = new Vector3(0.174f, 0.000f, 0.000f);
        setUpData.leftShoulder.collision.radius = 0.087f;
        setUpData.leftShoulder.collision.height = 0.343f;
//.........这里部分代码省略.........
开发者ID:Diggery,项目名称:SuperSneak,代码行数:101,代码来源:ConfigGuard.cs

示例2: Awake

    void Awake()
    {
        Transform janitorProxy = transform.Find("JanitorProxy");
        Destroy(janitorProxy.gameObject);

        janitorObj = Instantiate(janitorModel, Vector3.zero, Quaternion.identity) as Transform;
        janitorObj.name = "JanitorModel";
        janitorObj.parent = transform;
        janitorObj.localPosition = Vector3.zero;
        janitorObj.localRotation = Quaternion.identity;
        RagDollController janitorRagDoll = janitorObj.gameObject.AddComponent<RagDollController>();

        enemyAnimator = GetComponent<EnemyAnimator>();
        if (!enemyAnimator) Debug.Log("ERROR: Can't Find Enemy Animator");

        enemyController = GetComponent<EnemyController>();
        if (!enemyController) Debug.Log("ERROR: Can't Find Enemy Controller");

        Transform janitorRoot = janitorObj.Find ("Janitor_Skeleton/Root");
        if (!janitorRoot) Debug.Log("ERROR: Can't Find janitor Root");
        janitorRoot.gameObject.AddComponent<ExplosionCatcher>();

        Transform janitorHead = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody/Spine1/Spine2/Neck/Head");
        if (!janitorHead) Debug.Log("ERROR: Can't Find Janitor Head");

        Transform janitorUpperBody = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody");
        if (!janitorUpperBody) Debug.Log("ERROR: Can't Find janitorUpperBody");

        Transform janitorRightHand = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody/Spine1/Spine2/RightShoulder/RightElbow/RightWrist");
        if (!janitorRightHand) Debug.Log("ERROR: Can't Find Janitor Hand");

        Transform janitorUpperTorso = janitorObj.Find ("Janitor_Skeleton/Root/UpperBody/Spine1/Spine2");
        if (!janitorUpperTorso) Debug.Log("ERROR: Can't Find Janitor Torso");

        Transform janitorMop = janitorObj.Find ("Janitor_Geometry/Janitor_Mop");
        if (!janitorMop) Debug.Log("ERROR: Can't Find Janitor Mop");

        Transform janitorBucket = janitorObj.Find ("Janitor_Geometry/Janitor_Bucket");
        if (!janitorBucket) Debug.Log("ERROR: Can't Find Janitor Bucket");

        Transform[] accessories = new Transform[2];
        accessories[0] = janitorMop;
        accessories[1] = janitorBucket;

        enemyAnimator.setUp(janitorObj, janitorUpperBody);
        enemyController.setUp(janitorHead, janitorRagDoll, accessories);

        setUpData.layerName = "EnemyRagDoll";
        setUpData.rootTransform = janitorRoot;
        setUpData.root.collision.center = new Vector3(0.000f, 0.187f, -0.030f);
        setUpData.root.collision.size = new Vector3(0.507f, 0.575f, 0.305f);

        setUpData.leftHip.collision.center = new Vector3(-0.221f, 0.000f, 0.000f);
        setUpData.leftHip.collision.radius = 0.142f;
        setUpData.leftHip.collision.height = 0.475f;
        setUpData.leftHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftHip.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftKnee.collision.center = new Vector3(-0.35f, 0.000f, 0.000f);
        setUpData.leftKnee.collision.radius = 0.114f;
        setUpData.leftKnee.collision.height = 0.459f;
        setUpData.leftKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.leftKnee.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.rightHip.collision.center = new Vector3(0.237f, 0.000f, 0.000f);
        setUpData.rightHip.collision.radius = 0.142f;
        setUpData.rightHip.collision.height = 0.475f;
        setUpData.rightHip.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.rightHip.joint.swingAxis = new Vector3(0.0f, 0.0f, -1.0f);

        setUpData.rightKnee.collision.center = new Vector3(0.35f, 0.000f, 0.000f);
        setUpData.rightKnee.collision.radius = 0.114f;
        setUpData.rightKnee.collision.height = 0.459f;
        setUpData.rightKnee.joint.axis = new Vector3(0.0f, 0.0f, -1.0f);
        setUpData.rightKnee.joint.swingAxis = new Vector3(0.0f, 1.0f, 0.0f);

        setUpData.spine.collision.center = new Vector3(-0.160f, -0.005f, -0.000f);
        setUpData.spine.collision.size = new Vector3(0.321f, 0.304f, 0.507f);
        setUpData.spine.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.spine.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.head.collision.center = new Vector3(0.000f, 0.126f, 0.000f);
        setUpData.head.collision.radius = 0.126f;
        setUpData.head.joint.axis = new Vector3(1.0f, 0.0f, 0.0f);
        setUpData.head.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftShoulder.collision.center = new Vector3(0.174f, 0.000f, 0.000f);
        setUpData.leftShoulder.collision.radius = 0.087f;
        setUpData.leftShoulder.collision.height = 0.343f;
        setUpData.leftShoulder.joint.axis = new Vector3(0.0f, -1.0f, 0.0f);
        setUpData.leftShoulder.joint.swingAxis = new Vector3(0.0f, 0.0f, 1.0f);

        setUpData.leftElbow.collision.center = new Vector3(0.270f, 0.000f, 0.000f);
        setUpData.leftElbow.collision.radius = 0.108f;
        setUpData.leftElbow.collision.height = 0.542f;
        setUpData.leftElbow.joint.axis = new Vector3(0.0f, 0.0f, 1.0f);
        setUpData.leftElbow.joint.swingAxis = new Vector3(0.0f, -1.0f, 0.0f);

        setUpData.rightShoulder.collision.center = new Vector3(-0.174f, 0.000f, 0.000f);
        setUpData.rightShoulder.collision.radius = 0.087f;
//.........这里部分代码省略.........
开发者ID:Diggery,项目名称:SuperSneak,代码行数:101,代码来源:ConfigJanitor.cs


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