コード例 #1
0
ファイル: HeroSwim.cs プロジェクト: uenie/first-gate
    void Start()
    {
        hero       = transform;
        rb         = GetComponent <Rigidbody>();
        liftVector = new Vector3(0, 2.0f, 0);
        hMove      = GetComponent <HeroMotor> () as HeroMotor;
        hPhys      = GetComponent <HeroPhysic> () as HeroPhysic;
        hCam       = GetComponent <HeroCamera> () as HeroCamera;
        hClimb     = GetComponent <HeroClimb> () as HeroClimb;
        if (hCam.cam)
        {
            cam = hCam.cam;
        }
        bones = GetComponentsInChildren <Transform> () as Transform[];
        foreach (Transform t in bones)
        {
            if (t.name == "root")
            {
                rootB = t;
            }
        }
        // FX
        GameObject gO = (GameObject)Resources.Load("FX_WaterSurf");

        surfSplash        = (GameObject)Instantiate(gO, hero.position, Quaternion.identity);
        surfSplash.active = false;
    }
コード例 #2
0
ファイル: HeroClimb.cs プロジェクト: maxandr/Commandos
 //=================================================================================================================o
 void Start()
 {
     hero       = transform;
     rb         = rigidbody;
     climbState = ClimbState.None;
     Physics.IgnoreLayerCollision(8, 9);        // ignore player / climb collision
     hMove     = GetComponent <HeroMotor> () as HeroMotor;
     hSwim     = GetComponent <HeroSwim> () as HeroSwim;
     cacheDist = checkDistance;
 }
コード例 #3
0
    //=================================================================================================================o
    void Start()
    {
        hero    = transform;
        rb      = rigidbody;
        hMotion = GetComponent <HeroAnim> () as HeroAnim;
        hMove   = GetComponent <HeroMotor> () as HeroMotor;
        hClimb  = GetComponent <HeroClimb> () as HeroClimb;
        bones   = GetComponentsInChildren <Transform> () as Transform[];

        foreach (Transform t in bones)
        {
            if (t.name != hero.name && t.collider && t.rigidbody)
            {
                t.collider.isTrigger    = true;
                t.rigidbody.isKinematic = true;

                if (t.name == "root")
                {
                    rootBone = t;
                }
            }
        }
    }
コード例 #4
0
ファイル: HeroAnim.cs プロジェクト: Hotblack/project-other
    //=================================================================================================================o
    void Start()
    {
        hero = transform;
        //a = GetComponent <Animation>() as Animation;
        if (a.clip) {
            aC = a.clip;
        } else aC = a["idle"].clip;
        impactM = a["land"].clip;

        hMotor = GetComponent <HeroMotor>() as HeroMotor;
        hClimb = GetComponent <HeroClimb>() as HeroClimb;
        hPhys = GetComponent <HeroPhysic>() as HeroPhysic;
        hSwim = GetComponent <HeroSwim>() as HeroSwim;
        hKey = GetComponent <HeroKeymap>() as HeroKeymap;

        // Pass Delegates
        hMotor.doJumpDel += DoJump;
        hMotor.doBalanceDel += DoBalance;
        hMotor.doCombatDel += DoCombat;
        hMotor.doSwitchWeapDel += DoSwitchWeapons;
        hMotor.doEvadeDel += DoEvade;
        hMotor.doSneakDel += DoSneak;
        hClimb.doClimbDel += DoClimb;
        hSwim.doSwimDel += DoSwim;
        hPhys.doPhysDel += DoPhysx;

        currRot = 0.0f;
        leanRot = 0.0f;
        //sprintRot = 0.0f;
        lastRootForward = hero.forward;

        // Start is in Weaponstate.None, weaponless

        // Sword
        if (sword_Hand == null) // If no weapon is assigned
        {
            sword_Hand = new GameObject("emptyObj");
            sword_Hand.active = false;
        }
        else
            sword_Hand.active = false;
        if (sword_Holster == null) // If no weapon is assigned
        {
            sword_Holster = new GameObject("emptyObj");
            sword_Holster.active = false;
        }
        else
            sword_Holster.active = false;

        // Bow
        if (bow_Hand == null) // If no weapon is assigned
        {
            bow_Hand = new GameObject("emptyObj");
            bow_Hand.active = false;
        }
        else
            bow_Hand.active = false;
        if (bow_Holster == null) // If no weapon is assigned
        {
            bow_Holster = new GameObject("emptyObj");
            bow_Holster.active = false;
        }
        else
            bow_Holster.active = false;

        // Quiver
        if (bow_Quiver == null) // If no weapon is assigned
        {
            bow_Quiver = new GameObject("emptyObj");
            bow_Quiver.active = false;
        }
        else
            bow_Quiver.active = false;

        // Rifle
        if (rifle_Hand == null) // If no weapon is assigned
        {
            rifle_Hand = new GameObject("emptyObj");
            rifle_Hand.active = false;
        }
        else
            rifle_Hand.active = false;
        if (rifle_Holster == null)// If no weapon is assigned
        {
            rifle_Holster = new GameObject("emptyObj");
            rifle_Holster.active = false;
        }
        else
            rifle_Holster.active = false;

        // Pistol
        if (pistol_Hand == null)// If no weapon is assigned
        {
            pistol_Hand = new GameObject("emptyObj");
            pistol_Hand.active = false;
        }
        else
            pistol_Hand.active = false;
        if (pistol_Holster == null)// If no weapon is assigned
        {
            pistol_Holster = new GameObject("emptyObj");
            pistol_Holster.active = false;
        }
        else
            pistol_Holster.active = false;

        // Look for setup
        DoSwitchWeapons ();

        actionState = ActionState.None;
        evadeState = EvadeState.None;
        climbState = ClimbState.None;
    }
コード例 #5
0
ファイル: HeroSwim.cs プロジェクト: Hotblack/project-other
 void Start()
 {
     hero = transform;
     rb = rigidbody;
     liftVector = new Vector3 (0, 2.0f, 0);
     hMove = GetComponent <HeroMotor> () as HeroMotor;
     hPhys = GetComponent <HeroPhysic> () as HeroPhysic;
     hCam = GetComponent <HeroCamera> () as HeroCamera;
     hClimb = GetComponent <HeroClimb> () as HeroClimb;
     if (hCam.cam)
         cam = hCam.cam;
     bones = GetComponentsInChildren <Transform> () as Transform[];
     foreach (Transform t in bones)
     {
         if (t.name == "root")
             rootB = t;
     }
     // FX
     GameObject gO = (GameObject)Resources.Load( "FX_WaterSurf" );
     surfSplash = (GameObject)Instantiate (gO, hero.position, Quaternion.identity);
     surfSplash.active = false;
 }
コード例 #6
0
 //=================================================================================================================o
 void Start()
 {
     hero = transform;
     rb = rigidbody;
     climbState = ClimbState.None;
     Physics.IgnoreLayerCollision(8,9); // ignore player / climb collision
     hMove = GetComponent <HeroMotor> () as HeroMotor;
     hSwim = GetComponent <HeroSwim> () as HeroSwim;
     hKey = GetComponent <HeroKeymap> () as HeroKeymap;
     cacheDist = checkDistance;
 }
コード例 #7
0
    //=================================================================================================================o
    void Start()
    {
        hero = transform;
        rb = rigidbody;
        hMotion = GetComponent <HeroAnim> () as HeroAnim;
        hMove = GetComponent <HeroMotor> () as HeroMotor;
        hClimb = GetComponent <HeroClimb> () as HeroClimb;
        hKey = GetComponent <HeroKeymap> () as HeroKeymap;

        bones = GetComponentsInChildren <Transform> () as Transform[];

        foreach (Transform t in bones)
        {
            if (t.name != hero.name && t.collider && t.rigidbody)
            {
                t.collider.isTrigger = true;
                t.rigidbody.isKinematic = true;

                if (t.name == "root")
                    rootBone = t;
            }
        }
    }