Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        doExplode = false;
        startPos  = transform.position;
//		myMove = new SpeedUnit();

        curMappedController = new controller_keyboard();
        rb       = GetComponent <Rigidbody>();
        myWeapon = gameObject.GetComponentsInChildren <WeaponController>();

        if (myMoveUpdate == null && rb != null)
        {
            if (gameObject.GetComponent <UnitProperty>() != null)
            {
                myMoveUpdate = new MoveUpdateHelper();
                myMoveUpdate.Set_Rigid(rb);
                myMoveUpdate.Set_ExplosionCube(explosionCube_prefab);
                myMoveUpdate.Set_ChargablePower(gameObject.GetComponent <UnitProperty>().power_init, gameObject.GetComponent <UnitProperty>().speedUpDuration_init);
                if (myWeapon != null)
                {
                    myMoveUpdate.Set_WeapanHelp(myWeapon);
                }
                myRotateUpdate        = new RotateUpdateHelper();
                myRotateUpdate.transf = transform;
            }
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        if (myRig == null)
        {
            myRig = gameObject.GetComponent <Rigidbody>();

            myRotateUpdate        = new RotateUpdateHelper();
            myRotateUpdate.transf = transform;

            myAngle               = new AngleUnit();
            angleChecker          = new AngleUnit();
            angleChecker.myObject = gameObject;

            if (gameObject.transform.GetChild(1).name == "Unit_body")
            {
                Transform body = gameObject.transform.GetChild(1);

                barHander    = body.GetComponentInChildren <AttachBarHandler>();
                weaponHolder = body.GetComponentsInChildren <WeaponController>();
            }
            else
            {
                Debug.Log("Unit_body not found");
            }
        }
    }