Esempio n. 1
0
    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;
    }
Esempio n. 2
0
    //=================================================================================================================o
    void Start()
    {
        rb   = GetComponent <Rigidbody>();
        hero = transform;
        rb.freezeRotation = true;

        hClimb = GetComponent <HeroClimb> () as HeroClimb;
        hAnim  = GetComponent <HeroAnim> () as HeroAnim;
        hPhys  = GetComponent <HeroPhysic> () as HeroPhysic;

        hAnim.doSpeedDel  += DoSetSpeed;
        hAnim.doSwitchDel += DoSwitch;
        hPhys.doPhysDel   += DoReset;
        hClimb.doClimbDel += DoReset;
    }
Esempio n. 3
0
    //=================================================================================================================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;
    }
    //=================================================================================================================o
    void Start()
    {
        origField = Camera.main.fieldOfView;

        rb = rigidbody;
        hero = transform;
        rb.freezeRotation = true;

        hClimb = GetComponent <HeroClimb> () as HeroClimb;
        hAnim = GetComponent <HeroAnim> () as HeroAnim;
        hPhys = GetComponent <HeroPhysic> () as HeroPhysic;
        hKey = GetComponent <HeroKeymap> () as HeroKeymap;

        hAnim.doSpeedDel += DoSetSpeed;
        hAnim.doSwitchDel += DoSwitch;
        hPhys.doPhysDel += DoReset;
        hClimb.doClimbDel += DoReset;
    }
Esempio n. 5
0
 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;
 }