public override void Init() { base.Init(); var weaponSocket1 = transform.Find("Hand1"); var weaponSocket2 = transform.Find("Hand2"); dualWieldSockets = new Transform[] { weaponSocket1, weaponSocket2 }; singleSocket = new Transform[] { weaponSocket2 }; singleSocket2 = new Transform[] { weaponSocket1 }; weaponColl1 = weaponSocket1.GetComponent <BoxCollider2D>(); weaponColl2 = weaponSocket2.GetComponent <BoxCollider2D>(); Physics2D.IgnoreCollision (weaponColl2, GetComponent <BoxCollider2D>()); Physics2D.IgnoreCollision (weaponColl1, GetComponent <BoxCollider2D>()); InitNewInventory(); ActivateWeapon(inventory.Weapons[0]); // 2. check if save file exists -load if exists -make a new one if not--------------------------------------------------- /*if (File.Exists(Application.dataPath + "/savedata/HubData.test")) * { * hubSaveData = SaveSystem.Loadhubsavedata(); * inventory.SetCredits(hubSaveData.credits); * Debug.Log("HubDataLoaded" + hubSaveData.credits); * } * else * { * hubSaveData = new HubSaveData(10); * inventory.SetCredits(hubSaveData.credits); * } * if (File.Exists(Application.dataPath + "/savedata/autoSaveData.test")) * { * LoadAndSetPlayer(SaveSystem.LoadAutoSaveData()); * } * else { CreateAutoSaveData(); } // causing Curl error 56: Receiving data failed with unitytls error code 1048578 * */ //3. inventory UI init (assential??) commented out - not in use. //4. Direction indication directionIndication = transform.Find("DirectionIndication"); sprite = directionIndication.transform.Find("DirectionSprite"); directionIndicationSprite = sprite.GetComponent <SpriteRenderer>(); //dIColor = directionIndicationSprite.color; //5. State UI init( hp bar etc ) GameObject stateUIInstanceFixe = Instantiate(stateUIPrefabFixe,/*Vector3.Zero*/ new Vector3(0.0f, 3000.0f, 0.0f), Quaternion.identity) as GameObject; stateUIFixe = stateUIInstanceFixe.GetComponentInChildren <StateUI>(); stateUIFixe.Init(this, true, true);// character, hasEnergy, isFixed //GetInventory().AddCredits(10);//tmp stateUIFixe.UpdateCredits();//tmp //6.VFX init gainEnergyEffect = Resources.Load <GameObject>("Prefabs/Effects/DropEnergyEffect"); justOnceSmoke = new bool[2]; //7. etc gm = GameObject.Find("GameManager").GetComponent <GameManager>(); //8. initiated! (needed for cameraControl. ) initiated = true; stateUII = GameObject.Find("PlayerStateUI(Clone)"); stateUII.GetComponent <StateUI>().Refresh(); //bonus justOnceSmoke = new bool[2]; //9. initate player die effect deadEffectObj = transform.Find("DeadEffect").gameObject; deadEffectAnimObj = transform.Find("DeadEffectAnim").gameObject; playerDeadBody = GameObject.Find("Player").transform.Find("PlayerDeadBody").gameObject; playerMainBody = new GameObject[6]; playerMainBody[0] = GameObject.Find("Player").transform.Find("Body").gameObject; playerMainBody[1] = GameObject.Find("Player").transform.Find("Face").gameObject; playerMainBody[2] = GameObject.Find("Player").transform.Find("Hand1").gameObject; playerMainBody[3] = GameObject.Find("Player").transform.Find("Hand2").gameObject; playerMainBody[4] = GameObject.Find("Player").transform.Find("Foot1").gameObject; playerMainBody[5] = GameObject.Find("Player").transform.Find("Foot2").gameObject; //load and set data playerComb = GetComponent <PlayerCombatV1>(); playerComb.weapons[0] = GetActiveWeapon(); //saveSystemManager.InitSaveData(); stateUIFixe.Refresh(); }
//stupid code public void GetUpdateCredits() { stateUIFixe.UpdateCredits(); }