public void UpdateGameObjects()
    {
        gamePlayerController = null;
        gameDamageManager    = null;

        if (gamePlayerController == null)
        {
            gamePlayerController = gameObject.FindTypeAboveRecursive <GamePlayerController>();
        }

        if (gameDamageManager == null)
        {
            gameDamageManager = gameObject.GetOrSet <GameDamageManager>();
            gameDamageManager.UpdateGameObjects();
        }
    }
Example #2
0
    public void LoadAsset()
    {
        if (containerAssets == null)
        {
            return;
        }

        if (isActionCodeSave)
        {
            return;
        }

        if (assetCode != BaseDataObjectKeys.none &&
            lastAssetCode != assetCode)
        {
            lastAssetCode = assetCode;

            if (gameCharacter == null)
            {
                return;
            }

            assetAnimationNameIdle =
                gameCharacter.data.GetAnimationsByTypeIdle().code;

            assetAnimationNamePlay =
                gameCharacter.data.GetAnimationsByTypeStart().code;

            GameObject go = AppContentAssets.LoadAssetLevelAssets(
                gameCharacter.data.GetModel().code);

            if (go != null)
            {
                containerAssets.DestroyChildren();
                go.transform.parent = containerAssets.transform;
                go.TrackObject(containerAssets);


                if (isActionCodeAttack || isActionCodeDefend)
                {
                    // Add game damage

                    Collider goCollider = go.GetOrSet <Collider>();

                    if (goCollider != null)
                    {
                        gameDamageManager =
                            goCollider.gameObject.GetOrSet <GameDamageManager>();
                        gameDamageManager.audioHit           = "attack-hit-1";
                        gameDamageManager.effectDestroy      = "effect-explosion";
                        gameDamageManager.enableObjectRemove = false;
                        gameDamageManager.HP = hitPoints;

                        gameDamageManager.UpdateGameObjects();
                    }
                }

                AssetAnimationReset();
            }
        }
    }